473,543 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Applicatio n
Dim wdDoc As Word.Document

Set wdApp = New Word.Applicatio n

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

wdDoc.PrintOut Background:=

wdDoc.Close SaveChanges:=wd DoNotSaveChange s
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.Appli cation
Dim pbDoc As Publisher.Docum ent

Set pbApp = New Publisher.Appli cation

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

pbDoc.PrintOut Background:=Fal se
pbDoc.Close SaveChanges:=wd DoNotSaveChange s
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 5769
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],
[AddToRecentFile s As Boolean = True], [SaveChanges As PbSaveOptions =
pbPromptToSaveC hanges]) As Document
Member of Publisher.Appli cation
--

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.c om> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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.Applicatio n
Dim wdDoc As Word.Document

Set wdApp = New Word.Applicatio n

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

wdDoc.PrintOut Background:=

wdDoc.Close SaveChanges:=wd DoNotSaveChange s
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.Appli cation
Dim pbDoc As Publisher.Docum ent

Set pbApp = New Publisher.Appli cation

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

pbDoc.PrintOut Background:=Fal se
pbDoc.Close SaveChanges:=wd DoNotSaveChange s
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
1557
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 what I would like to know is: - What software application/platform do YOU use to publish your XML to print? (assuming PDF is the end goal ... and,...
2
1784
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
5687
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 of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me...
6
1873
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 8.5 * 11 paper. I'm not sure how to this in HTML. 2) A PDF can be set to print all pages. I'm not sure how to do this with html either. Suggesting...
0
1497
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 publicher DB became corrupted therefore we pointed all activity to the subscriber DB. Now we would like to bring back the publisher online, but we...
0
1544
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 developed to add button bars to Publisher 2003. When built these under VS 2003, they worked. I used the conversion wizard in VS 2005 to convert them. I...
0
882
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 already open? All the documentation I've seen revolves around creating a new publisher application object, or opening an existing file. I guess what I...
0
992
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 that is already open? All the documentation I've found revolves around creating a new publisher application object, or opening an existing file....
0
1193
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 something?
0
7402
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7590
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7733
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7344
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7684
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3388
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
963
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.