By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

Print Publisher document

P: n/a
Users want to click on a control and immediately ship a Publisher -- or
PDF -- document to the printer.

I found an old conversation with this code for Word:

Dim wdApp As Word.Application
Dim wdDoc As Word.Document

Set wdApp = New Word.Application

Set wdDoc =
wdApp.Documents.Open("\\server\Data\Inventory\Test .doc")

wdDoc.PrintOut Background:=

wdDoc.Close SaveChanges:=wdDoNotSaveChanges
wdApp.Quit

Set wdDoc = Nothing
Set wdApp = Nothing
It worked in my Access app after I set up References to include the
Microsoft Word Object Library.

"Aha!" I thought. "Just a few tweaks and I can get the same results
for a Publisher document."

So I added Microsoft Publisher Object Library to References and tried
the following code, which produces a compile error on the
pbApp.Documents.Open statement.

Dim pbApp As Publisher.Application
Dim pbDoc As Publisher.Document

Set pbApp = New Publisher.Application

Set pbDoc =
pbApp.Documents.Open("\\server\Data\Inventory\test pub1.pub")

pbDoc.PrintOut Background:=False
pbDoc.Close SaveChanges:=wdDoNotSaveChanges
pbApp.Quit

Set pbDoc = Nothing
Set pbApp = Nothing

Any insights into how I need to adjust this, or what I need to do
instead? Bonus points for code that works on PDF files!

PEmigh

Nov 28 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The Open method you want is a member of the Application object, not the
Document object.

Function Open(Filename As String, [ReadOnly As Boolean = False],
[AddToRecentFiles As Boolean = True], [SaveChanges As PbSaveOptions =
pbPromptToSaveChanges]) As Document
Member of Publisher.Application
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"pemigh" <pe****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Users want to click on a control and immediately ship a Publisher -- or
PDF -- document to the printer.

I found an old conversation with this code for Word:

Dim wdApp As Word.Application
Dim wdDoc As Word.Document

Set wdApp = New Word.Application

Set wdDoc =
wdApp.Documents.Open("\\server\Data\Inventory\Test .doc")

wdDoc.PrintOut Background:=

wdDoc.Close SaveChanges:=wdDoNotSaveChanges
wdApp.Quit

Set wdDoc = Nothing
Set wdApp = Nothing
It worked in my Access app after I set up References to include the
Microsoft Word Object Library.

"Aha!" I thought. "Just a few tweaks and I can get the same results
for a Publisher document."

So I added Microsoft Publisher Object Library to References and tried
the following code, which produces a compile error on the
pbApp.Documents.Open statement.

Dim pbApp As Publisher.Application
Dim pbDoc As Publisher.Document

Set pbApp = New Publisher.Application

Set pbDoc =
pbApp.Documents.Open("\\server\Data\Inventory\test pub1.pub")

pbDoc.PrintOut Background:=False
pbDoc.Close SaveChanges:=wdDoNotSaveChanges
pbApp.Quit

Set pbDoc = Nothing
Set pbApp = Nothing

Any insights into how I need to adjust this, or what I need to do
instead? Bonus points for code that works on PDF files!

PEmigh

Nov 28 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.