Controlling Publisher 2000 from word macro

I

Ian McLeish

I have been trying to open publisher using microsoft word, to open a
mailmerge document, show the details, and then print it out. I can get
Publisher to open, but I cannot work out how toggle the mailmerge fields- to
show the details rather than the mailmerge field codes. Also, I can get the
printer to print using this macro, but I obviously have the wrong code,
because all it does is dump a single blank page.
It is a long winded reason why I want to control Publisher from word, but
basically I need to kick things off in a Document Template. Perhaps it would
be better to use a macro in Publisher, but then how would I call a macro in
Pub from word? Below is the code I have been unsuccessfully trying.

Thanks in advance for any suggestions,

Ian

Sub OpenNewPub()


Dim appPub As New Publisher.Application
appPub.Open FileName:="c:\documents and settings\Ian McLeish\My
Documents\TestRecord Card2000 4th Attempt.pub", _
ReadOnly:=True, AddToRecentFiles:=False, _
SaveChanges:=pbPromptToSaveChanges
appPub.ActiveWindow.Visible = True
'ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
ThisDocument.PrintOut
End Sub
 
J

Jean-Guy Marcil

Ian McLeish was telling us:
Ian McLeish nous racontait que :
I have been trying to open publisher using microsoft word, to open a
mailmerge document, show the details, and then print it out. I can get
Publisher to open, but I cannot work out how toggle the mailmerge
fields- to show the details rather than the mailmerge field codes.
Also, I can get the printer to print using this macro, but I
obviously have the wrong code, because all it does is dump a single
blank page.
It is a long winded reason why I want to control Publisher from word,
but basically I need to kick things off in a Document Template.
Perhaps it would be better to use a macro in Publisher, but then how
would I call a macro in Pub from word? Below is the code I have been
unsuccessfully trying.

Thanks in advance for any suggestions,

Ian

Sub OpenNewPub()


Dim appPub As New Publisher.Application
appPub.Open FileName:="c:\documents and settings\Ian McLeish\My
Documents\TestRecord Card2000 4th Attempt.pub", _
ReadOnly:=True, AddToRecentFiles:=False, _
SaveChanges:=pbPromptToSaveChanges
appPub.ActiveWindow.Visible = True
'ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
ThisDocument.PrintOut
End Sub

Never done any VBA in Publisher.... Just checked the Object Model and there
is a MailMerge object.

Try in a Publisher NG.

Meanwhile:
In your code:
'ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
ThisDocument.PrintOut

What does "ThisDocument" refer to? Word or Publisher?
How about "ActiveDocument"

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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