473,657 Members | 2,505 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 6881
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_Before Save(ByVal SaveAsUI As Boolean, Cancel As Boolean)
On Error GoTo OutOfHere
If SaveAsUI Then
Application.Ena bleEvents = False
Cancel = True
Call MySubstituteSub
End If
OutOfHere:
Application.Ena bleEvents = True
End Sub
'--

'In a standard module...
Sub MySubstituteSub ()
Application.Dia logs(xlDialogSa veAs).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
8660
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. the return value is TRUE. i tested it by going to windows explorer and then click that computer. my coding at windows service:
0
1816
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 page label document, I get "x" formfeeds and "x" wasted labels. Is there any way to manipulate the .NET printing engine to do a over-under 2-up landscape printing? I'm thinking no, but maybe there's a way. The printer has the ability to sense the...
2
13624
by: Sean McKaharay | last post by:
I want to find out how I can change the page orientation of a printer.
2
15477
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: encType="multipart/form-data" <INPUT id="UploadFile" type="file" name="UploadFile" runat="server"> Private Sub btnUploadFile_Click(ByVal sender As System.Object, ByVal e
2
1732
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 that which is client card, which show some information from contact profile in 3.5"x5.5" as well as can be print on same size on printer? How can I make asp page with 3.5"x5.5" size?
2
9563
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 way that I can simply "print" the data to the printer without worrying about paging, fonts etc. ie something like:
1
1333
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 job is to print the company's existing mailer statements (about 5 copies deep with their copy on top, envelope underneath that, tractor tears on sides, then inside closed up envelope is client's copy of bill, plus return envelope, plus stub to...
1
8749
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 standard dialogs). (On some Print dialogs (such as in Word and Excel) this button is labelled "Properties". And just to avoid being too consistent, it is labelled "Options" on the Excel PageSetup dialog.) I thought that this would be trivial,...
4
3326
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 : ~/some_dir/lib/PDF/API2/ ~/some_dir/lib/PDF/API2.pm ~/some_dir/lib/sun4-solaris I am using the "use lib" pragma in script.The exact syntax is as below use lib "~/some_dir/lib/PDF";
0
8420
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
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 we have to send another system

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.