I am trying to use the following code to open and format a word document but it fails with
Microsoft VBScript runtime error: Type mismatch: 'InchesToPoints'
I have no idea what is wrong with the code which uses word97
Dim appWord
Set appWord = CreateObject("Word.Application"
appWord.Visible = True
appWord.Documents.Open("d:\wsh\testout.doc"
strName = appWord.ActiveDocument.Name
strPath = appWord.ActiveDocument.Path & "\"
With appWord.ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = .92
.TopMargin = InchesToPoints(1)
.BottomMargin = 1
.LeftMargin = 1
.RightMargin = 1
.Gutter = 1
.HeaderDistance = 0.5
.FooterDistance = 0.5
.PageWidth = 11
.PageHeight = 8.5
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
End With
I would be grateful for any help
Cheers
Microsoft VBScript runtime error: Type mismatch: 'InchesToPoints'
I have no idea what is wrong with the code which uses word97
Dim appWord
Set appWord = CreateObject("Word.Application"
appWord.Visible = True
appWord.Documents.Open("d:\wsh\testout.doc"
strName = appWord.ActiveDocument.Name
strPath = appWord.ActiveDocument.Path & "\"
With appWord.ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = .92
.TopMargin = InchesToPoints(1)
.BottomMargin = 1
.LeftMargin = 1
.RightMargin = 1
.Gutter = 1
.HeaderDistance = 0.5
.FooterDistance = 0.5
.PageWidth = 11
.PageHeight = 8.5
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
End With
I would be grateful for any help
Cheers