D
DaveP
I'm having a problem with some VB.NET code that is using automation to create
and print a Word document. When I try to set the page margins in code, I'm
getting an error 4608, "Value out of range" error.
When I check the value of the TopMargin property before I try to set it,
it's got a value of 9999999.0. And then when I try to set the value to 43.2
points (.6 inches), which is well withing the allowable range, I get the
error.
The code looks something like:
' wvhWndWord is defined as Word.Application, WithEvents
With wvhWndWord
.Visible = True
.WindowState = Word.WdWindowState.wdWindowStateMaximize
' wvnDocNo is defined as Word.Document
wvnDocNo = .Documents.Open(wvDocName, , True, True)
With wvnDocNo.PageSetup
.TopMargin = .Application.InchesToPoints(0.6)
....
As soon as I try to set .TopMargin, I get the error. I have made sure that
the .Application.InchesToPoints(0.6) is working. This returns a value of
43.2.
Thanks for any help you can give.
and print a Word document. When I try to set the page margins in code, I'm
getting an error 4608, "Value out of range" error.
When I check the value of the TopMargin property before I try to set it,
it's got a value of 9999999.0. And then when I try to set the value to 43.2
points (.6 inches), which is well withing the allowable range, I get the
error.
The code looks something like:
' wvhWndWord is defined as Word.Application, WithEvents
With wvhWndWord
.Visible = True
.WindowState = Word.WdWindowState.wdWindowStateMaximize
' wvnDocNo is defined as Word.Document
wvnDocNo = .Documents.Open(wvDocName, , True, True)
With wvnDocNo.PageSetup
.TopMargin = .Application.InchesToPoints(0.6)
....
As soon as I try to set .TopMargin, I get the error. I have made sure that
the .Application.InchesToPoints(0.6) is working. This returns a value of
43.2.
Thanks for any help you can give.