
Signature
Ed Bennett - MVP Microsoft Publisher
Ed, thanks, but as I said I am a complete dunce at this, and will gladly
copyany pieces of coding I think might be useful for my purposes. I have no
idea about declaring a variable as a Publisher.Applicication, and please
don't think I am proud to admit that, but it is true. I know that you are
used to helping people that at least have some idea, but if you wouldn't
mind.....
Set wrd = GetObject(, "Word.Application")
wrd.Visible = True
wrd.Documents.Open "C:\My Documents\Temp.doc"
Set wrd = Nothing
I found this code, which opens word and then a document. I (obviously
wrongly)thought I might just be able to replace word.application with
publisher.application and then point it at my record card.pub, to at least
get it to open, but alas...
Am I completely wrong in my above assumption?
Thanks in anticipation.
Ian
> > I found the shell function in word which can open publisher, and I
> > managed to get a Publisher macro going which would toggle the
[quoted text clipped - 18 lines]
> And Andrew May's technical article series on Publisher at
> http://msdn.microsoft.com/office/understanding/publisher/default.aspx?
Ed Bennett - 21 Sep 2005 21:41 GMT
> Set wrd = GetObject(, "Word.Application")
> wrd.Visible = True
[quoted text clipped - 7 lines]
>
> Am I completely wrong in my above assumption?
Not completely.
I haven't used GetObject to create a new Publisher application, I would
normally instead use
Dim pubApp As New Publisher.Application
But I see no reason why the code you quote above shouldn't work in that
context.
Publisher's object model, however, is different from Word's in many ways.
In Publisher, to open a new document, you instead use the code:
pubApp.Open(FileName, ReadOnly, AddToRecentFiles, SaveChanges,
OpenConflictDocument)
FileName Required String. The name of the publication (paths are
accepted).
ReadOnly Optional Boolean. True to open the publication as read-only.
Default is False.
AddToRecentFiles Optional Boolean. True (default) to add the file name to
the list of recently used files at the bottom of the File menu.
SaveChanges Optional PbSaveOptions. Specifies what Publisher should do if
there is already an open publication with unsaved changes.
OpenConflictDocument Optional Boolean. True to open the local conflict
publication if there is an offline conflict. Default is False.
This is documented in (and copied and pasted from) the Publisher VBA help
file that I listed in my previous post.
As the Open method returns a Document object, I would advise that you
declare a variable with which to reference this new document, as it will
save you fiddling around with ActiveDocument.
Dim pubApp As New Publisher.Application
Dim pubDocument As Publisher.Document
Set pubDocument = pubApp.Open("C:\My Documents\Temp.pub")
Note that you will have to add a reference to the Publisher Object Model in
your Word IDE to be able to do this.

Signature
Ed Bennett - MVP Microsoft Publisher