473,503 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel VBA print to "PDF Printer"?

2 New Member
In Excel, I need to
1. Select "PDF printer" from the printer list when printing a page
2. Recognize when the "Save As" window comes up
3. And then Sendkeys "finename~" to save the PDF file.

I have step 3, but I need help with 1 and 2. Thoughts? Thanks.
Nov 5 '08 #1
2 6868
ladams1949
2 New Member
Just me again. I found an answer for 1. I just need 2. I should add that this is in VBA and Excel 2003.

Again, I just need to be able to recognize when a window captioned "Save As" appears so that I can then use sendkeys to provide the desired filename.

Thanks.
Nov 5 '08 #2
ubentook
58 New Member
You can trap for the display of the SaveAs dialog box in the ThisWorkbook Before Save event.
You can then display the SaveAs dialog box and include the file name to be used...
'--
'In the ThisWorkbook module...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
On Error GoTo OutOfHere
If SaveAsUI Then
Application.EnableEvents = False
Cancel = True
Call MySubstituteSub
End If
OutOfHere:
Application.EnableEvents = True
End Sub
'--

'In a standard module...
Sub MySubstituteSub()
Application.Dialogs(xlDialogSaveAs).Show "My File Name"
End Sub
Nov 5 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
8638
by: Mullin Yu | last post by:
if i put the same code at the windows application or console, i can logon to the computer. but, if i put the same code at the windows service and start it, i still can't logon to the machine. ...
0
1796
by: Matthew Belk | last post by:
I am trying to print some 2x6 labels on a SATO CL408e thermal label printer. The 2x6 labels are arranged in "landscape" mode with 2 labels per "sheet." When I attempt to print "x" copies of a 1...
2
13617
by: Sean McKaharay | last post by:
I want to find out how I can change the page orientation of a printer.
2
15460
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
2
1723
by: Munnu | last post by:
How can I make asp page that prints the contact information in 3.5"x5.5" (like business card) area? I have asp page that contains the information for my contact and I need to make one more view on...
2
9550
by: Simon Verona | last post by:
I have a receipt printer that is set up using a generic/text print driver. I want to send a print to it. The standard vb.net printing methodology seems a little bit of overkill. Is there any...
1
1321
by: Ron | last post by:
Hi All, I've got a requirement to print an existing statement printing report to another printer that's set up to print on a wide-carriage, bottom-fed dot-matrix printer. That printer's sole...
1
8707
by: =?Utf-8?B?T21lZ2FTcXVhcmVk?= | last post by:
have customized PageSetup and Print dialogs that emulate the standard dialogs. I would like to be able to open the "Printer Preferences" dialog by clicking a button (just like can be done on the...
4
3312
by: kapilsri22 | last post by:
Hi All, I am trying to use PDF::API2 module . Since i do not have the root access, I installed the above module locally at ~/some_dir/lib. The contents of ~/some_dir/lib are : ...
0
7205
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
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
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
7467
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...
0
5592
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,...
1
5021
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...
0
3175
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...
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.