Page Setup in VBA Problems

A

Adrian

I have an Access 2000 system running a word 2000 mail
merge document via OLE. The first run of the
document is ok, the next run I get an invalid value error
when trying to access any of the PageSetup properties and
examining the property in the watch window shows a value
of 999999 ? Can anyone help ?

Code posted below

This is where I pick up the application object reference

oleReport.Verb = acOLEVerbOpen
oleReport.Action = acOLEActivate
Set wordobj = Me.oleReport.Object.Application


Then the pagesetup code is

wordobj.Documents(1).Activate
wordobj.Documents
(1).PageSetup.DifferentFirstPageHeaderFooter = True
wordobj.Documents(1).SectionStart = wdSectionContinuous
wordobj.Documents(1).Repaginate


The exact error message is "value out of range", error
number 4608


Thanks
 
C

Cindy M -WordMVP-

Hi Adrian,

Could you show us all the code involved in RELEASING the
Word OLE object and related variables?
I have an Access 2000 system running a word 2000 mail
merge document via OLE. The first run of the
document is ok, the next run I get an invalid value error
when trying to access any of the PageSetup properties and
examining the property in the watch window shows a value
of 999999 ? Can anyone help ?

Code posted below

This is where I pick up the application object reference

oleReport.Verb = acOLEVerbOpen
oleReport.Action = acOLEActivate
Set wordobj = Me.oleReport.Object.Application


Then the pagesetup code is

wordobj.Documents(1).Activate
wordobj.Documents
(1).PageSetup.DifferentFirstPageHeaderFooter = True
wordobj.Documents(1).SectionStart = wdSectionContinuous
wordobj.Documents(1).Repaginate


The exact error message is "value out of range", error
number 4608

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
Top