Error in MS Word VBA for pagesetup Dialog

G

Guest

HI,

Please Help me in finding cause for an error in following code in VBA for MS
Word 2000:

Set oApp = New Word.Application

With oApp.Dialogs(wdDialogFilePageSetup)
.Default = -1
.Execute
End With

At .Execute following error message is encountered.
"the measurement must be between 0" and 22"

No where on the web I could find cause for this error.

Thanks in advance
SRV
New York
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?U1JW?=,
Please Help me in finding cause for an error in following code in VBA for MS
Word 2000:

Set oApp = New Word.Application

With oApp.Dialogs(wdDialogFilePageSetup)
.Default = -1
.Execute
End With

At .Execute following error message is encountered.
"the measurement must be between 0" and 22"
Note: It's better to ask for VBA help in a Word programming group; this group
is mainly frequented by end-users.

The error message you quote is an error in the Word UI, not a VBA error. It's
crops up when a margin setting conflicts with what the current printer driver
tells Word is acceptable. It can also be caused by "other things", such as a
damaged file. What are you trying to achieve with this code?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

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

Guest

Thanks Cindy for you suggestion.!
I was trying to set the default page setup(that of normal template) using
that piece of code so that my application do not go cranky with different
formats for mail merging documents.

Interesting thing is the original document which gives error from this code
do not
give any error when I try from File-> Page Setup -> Default button. My code
should be doing the same.

-SRV
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?U1JW?=,
I was trying to set the default page setup(that of normal template) using
that piece of code so that my application do not go cranky with different
formats for mail merging documents.

Interesting thing is the original document which gives error from this code
do not
give any error when I try from File-> Page Setup -> Default button. My code
should be doing the same.
Mmmm. It goes against my grain to "fiddle" with the settings in the user's
Normal.dot. Normal.dot really belongs to the user, not the developer...

Can you explain in a bit more detail how your "mail merge application" is
supposed to function, as far as interfacing with the user goes? Any reason,
for example, you wouldn't use a template specific to the project, or just
change the page settings for any document used by your application?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top