Hi All. This is VB embedded in Word but I am hoping you clever people can help me as you have done so many times before with my XL queries.
My code pastes a number of sheets to a new doc and saves before emailing. The only prob I have is that it adds a blank page which is fine if emailing but wasteful when printing. The code clearly states pages 7-9. Is there anyway I can stop VB adding a blank page on the end?
Any suggestions would be most appreciated. Thanks
If optage.Value = True Then
'to paste pages to new doc
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=7
Set rgePages = Selection.Range
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=9
rgePages.End = Selection.Bookmarks("\Page").Range.End
rgePages.Select
Selection.Copy
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
Selection.PasteAndFormat (wdPasteDefault)
'and save as temp file
ActiveDocument.SaveAs FileName:=Environ("TEMP") & "\discrimtemp.doc"
ActiveDocument.Close
End If
My code pastes a number of sheets to a new doc and saves before emailing. The only prob I have is that it adds a blank page which is fine if emailing but wasteful when printing. The code clearly states pages 7-9. Is there anyway I can stop VB adding a blank page on the end?
Any suggestions would be most appreciated. Thanks
If optage.Value = True Then
'to paste pages to new doc
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=7
Set rgePages = Selection.Range
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Count:=9
rgePages.End = Selection.Bookmarks("\Page").Range.End
rgePages.Select
Selection.Copy
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
Selection.PasteAndFormat (wdPasteDefault)
'and save as temp file
ActiveDocument.SaveAs FileName:=Environ("TEMP") & "\discrimtemp.doc"
ActiveDocument.Close
End If