473,416 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 5751
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.