Printing problem !

M

Mark

I am using Word 97. The following code works on one of my
templates but won't work on another one.

Can anyone help with a solution, please?


Public Sub S2_PrintGuidance()
Dim x As Integer
Dim sPageNo As String

Selection.EndKey Unit:=wdStory

Application.ScreenUpdating = False

Application.DisplayAutoCompleteTips = True

Selection.InsertBreak Type:=wdPageBreak

ActiveDocument.AttachedTemplate.AutoTextEntries
("S2_Guidance").Insert Where:= _
Selection.Range, RichText:=True

x = Selection.Information(wdActiveEndPageNumber)

sPageNo = x

'**********************************************************
*************
'This bit won't print anything !!
Application.Printout FileName:="",
Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:=sPageNo,
PageType:= _
wdPrintAllPages, Collate:=True, Background:=True,
PrintToFile:=False

'*********************************************************
**************
'This bit prints the active page !!

' Application.Printout FileName:="",
Range:=wdPrintCurrentPage, Item:= _
' wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
' Collate:=True, Background:=True,
PrintToFile:=False


Selection.MoveUp Unit:=wdLine, Count:=31,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1



With Selection 'Moves to start of document

.GoTo What:=wdGoToBookmark,
Name:="InitialResponse"
End With

Application.ScreenUpdating = True

End Sub



Thanks in anticipation



Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top