J
jridgway
Hello all,
I've been tasked with converting UNIX documents to PDF. For the most
part, all is working just fine. Most docs are processed correctly and
use the standard paper size (letter). It came to my attention last
week that I needed to format certain docs to use paper size (Legal).
I have tried all sorts of combinations to get word to do this
programmatically, without success. I have searched and tried many
solutions provided here and none have provided the answer.
I have included the code below responsible for the formatting of the
word doc as it is being processed.
Set WDoc = CreateObject("Word.Application")
With WDoc
'.Visible = False
.Visible = True
'.Activate
.Documents.Open sDoc
.ActiveDocument.PageSetup.Orientation = 1
.ActiveDocument.PageSetup.PageSize(wdPaperLegal) <---- Current
attempt
'if htmlReportNum = "D004_D_BECPB" then
'.ActiveDocument.PageSetup.PageSize = wdPaperLegal <----Other
attempts
'For each sec in ActiveDocument.Sections
'sec.PageSetup.PaperSize(wdPaperLegal) <----Other attempts
'Next
'ActiveDocument.PageSetup.PageWidth = 14 <----Other attempts
'ActiveDocument.PageSetup.PageHeight = 8.5 <----Other attempts
'.pagesize=wdPaperLegal <----Other attempts
'else
'ActiveDocument.PageSetup.PageWidth = InchesToPoints(11)
'ActiveDocument.PageSetup.PageHeight = InchesToPoints(8.5)
'.ActiveDocument.PageSetup.PaperSize = wdPaperLetter
'end if
if htmlReportNum = "D004_D_BECPB" then
WScript.Echo htmlReportNum
end if
.ActiveDocument.PrintOut(False)
'.ActiveDocument.PrintOut(True)
'.Options.PrintBackGround = False
.ActiveDocument.Close
.Application.Quit
End With
Set WDoc=Nothing
With all of these attempts, no error is reported indicating that my
attempt to choose a paper size is invalid.
Thanks for any help you may be able to provide.
I've been tasked with converting UNIX documents to PDF. For the most
part, all is working just fine. Most docs are processed correctly and
use the standard paper size (letter). It came to my attention last
week that I needed to format certain docs to use paper size (Legal).
I have tried all sorts of combinations to get word to do this
programmatically, without success. I have searched and tried many
solutions provided here and none have provided the answer.
I have included the code below responsible for the formatting of the
word doc as it is being processed.
Set WDoc = CreateObject("Word.Application")
With WDoc
'.Visible = False
.Visible = True
'.Activate
.Documents.Open sDoc
.ActiveDocument.PageSetup.Orientation = 1
.ActiveDocument.PageSetup.PageSize(wdPaperLegal) <---- Current
attempt
'if htmlReportNum = "D004_D_BECPB" then
'.ActiveDocument.PageSetup.PageSize = wdPaperLegal <----Other
attempts
'For each sec in ActiveDocument.Sections
'sec.PageSetup.PaperSize(wdPaperLegal) <----Other attempts
'Next
'ActiveDocument.PageSetup.PageWidth = 14 <----Other attempts
'ActiveDocument.PageSetup.PageHeight = 8.5 <----Other attempts
'.pagesize=wdPaperLegal <----Other attempts
'else
'ActiveDocument.PageSetup.PageWidth = InchesToPoints(11)
'ActiveDocument.PageSetup.PageHeight = InchesToPoints(8.5)
'.ActiveDocument.PageSetup.PaperSize = wdPaperLetter
'end if
if htmlReportNum = "D004_D_BECPB" then
WScript.Echo htmlReportNum
end if
.ActiveDocument.PrintOut(False)
'.ActiveDocument.PrintOut(True)
'.Options.PrintBackGround = False
.ActiveDocument.Close
.Application.Quit
End With
Set WDoc=Nothing
With all of these attempts, no error is reported indicating that my
attempt to choose a paper size is invalid.
Thanks for any help you may be able to provide.