472,373 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

Print Publisher document

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
1 5642
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Allan Shearer | last post by:
Hi Everyone I'm not looking to start a war here between Linux, Unix, Windows or Mac users ... nor to do the same amongst users of major (or minor!) brand name publishing applications ... but...
2
by: Brent Burkart | last post by:
I want to programatically create a Microsoft Publisher document using .NET. Has anyone tried this or seen any tutorials? Any help is appreciated. Thanks, Brent
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
6
by: Jeff Thies | last post by:
I have a club newsletter that is currently distributed as a PDF. I'm considering converting this to html... Several problems ensue. 1) PDF's can be formatted for a page to fit on a sheet of...
0
by: Ron | last post by:
Hi All, I am fairly new to MS SQL Replication. I have two servers one is setup as the publisher and the other is setup as both the subscriber and the distributor. Due to server reboots, the...
0
by: =?Utf-8?B?TWFyayBX?= | last post by:
I have just upgraded Visual Studio from 2003 to 2005 and am in the process of converting my VB applications. Most conversions have gone quite smoothly. However, I have several Add-Ins that I...
0
by: Dean Player | last post by:
Hi, I tried posting this question in the interop newsgroup, with no luck, so I'm trying here: Using vb .net 2005 or 2008, does anyone know how I would interact with a Publisher file that is...
0
by: Dean Player | last post by:
Hi, I tried posting this question in the interop & general newsgroups, with no luck, so I'm trying here: Using vb .net 2005 or 2008, does anyone know how I would interact with a Publisher file...
0
by: =?Utf-8?B?T3N0cmljaCBMYWR5?= | last post by:
In previous versions of Publisher, whenever I selected a printer and page/print selections, it was saved with the document. It doesn't appear to be doing this with Publisher 2007. Am I missing...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.