Free Microsoft Excel 2013 Quick Reference

Vba printer Results

This is what I'm trying to do. I have a report with a subreport, I want to print the main form in one printer tray andprint the sub report in another tray. Anyone have any ideas? The subform print after the details data print, i put it in the footer to make it easier. when the subreport is forced to a new page all the timeand thats why i want to print it in a different tray.
I'm trying to do this in Access. But I know that most of the vba in ms office is identical.


I have developed one file for invoice printing using VBA coding.

When i take print out from excel workbook the print out is comming in Windows Font (i want like Dos prompt printing).

I want to take printout in Dot matrics printer for invoice printing and the print out has to come like Lotus123 spreadsheet print out (dos mode).

is it possible to get print out like Lotus123? If possible can u please tell me how to change the printing property in excel spreadsheet.



I'm trying to save excel files as pdf using vba code and the cutepdf printer. If I do this manually it works, but when I write code it saves the output to a file that cannot be read or opened

Unfortunately I don't have access to the pdfdistiller so can't use this technique which I've seen described in a number of forums.

The code I've used is below. Any help would be gratefully received.



PHP Code:
Sub pdfing()

Dim cntTrue As Long, cnt As Long
Dim rng As Range, bk As Workbook
Dim fName As String
Dim WB As Workbook
Dim FundName As String

Workbooks.Open ("S:SRQFSFCWNames")



            FundName = ActiveCell.Value
            fName = Dir("S:SRQFS" & FundName & ".xls")
            Do While fName  ""
            Workbooks.Open ("S:SRQFS" & fName), UpdateLinks:=0
            cnt = cnt + 1
            fName = Dir()
            Application.ScreenUpdating = False
            ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources


            ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="CutePDF Printer", printtofile:=True, collate:=True, prtofilename:="S:SRQFS" & FundName & ".pdf"


ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""

End Sub 

First, thank you for such an informative and fantastic website. I've been going through for the past hour and taking copious notes to use on my current project to better streamline it/solve some errors.

The question I have is, is it possible to use code to save a workbook? I know this is pretty basic, but for the life of me, I cannot answer this question searching the entire website and forums. I'm currently creating what could be called a "yearly timesheet" for a small company and trying to automate it as much as possible. I've created several buttons along with input boxes to create the data, now I would like to make two more, one to save the worksheet (preferrably using data from one cell as the workbook name) and a second to send the workbook to the local, default printer. I've come across the topics on stopping Excel from automatically asking the user to save it, etc etc but none along the lines of "this is how you create a button that if clicked, saves the workbook."

Thanks for time and happy spreadsheeting

Here is my problem. I have a macro set up that will save an excel spreedsheet as a PDF file. To do this is a print function. The problem now is that the printer stays on the PDF995. Is there a line of code I could input to where the printer would go back to the default printer? There are several people who use this program and they all have a different default printer and the main template is saved on a network drive.


Hi folks!

I'm currently writing a macro in VBA that will print out a selection of worksheets. The macro works fine, except that I don't know how to set it up so that the user is prompted to choose from the list of printers (as you would normally do when printing).

Also, does anyone happen to know if there is any code I can use to ask the print-outs to be configured to fit the page better (ie. automatically set the zoom).

Many, many, many thankyous to anybody with advice on this one!


What would be the simplest VBA code to locate the command bar number that the printer command button is on & put the number into a variable.

I am trying to add two command buttons immediately after the printer command button but the printer button is on a different command bars from computer to computer.

For example, it may be on command bar #3 on one computer but on #4 of another computer.

Thanks, you guys are great! mikeburg

My first thread. Hope its OK.

I am using xl2003 and windows xp.

I would like to use a control and VBA to allow the user to select the printer to be used in a print task. I want them to be able to choose from multiple printers if they are availible. Which control would work best? What would the code look like?

My workbook is used by dealers around the country to submit warranties via e-mail. The menu bar and Task bars have been elliminated and disabled so the workbook cannot be altered in any way.

Any help or suggestions in this matter would be greatly appreciated.

Is there a way that i can retrieve printer infomation like, Status, Location and Comments into a VBA Userform. I have made this userform and it needs printer information without going into xlprinterdialog.




I'd like to add a select printer function to a vba add in I have written, but I can't figure out how to get a list of printers installed on the pc. I'd also like to be able to change the default printer.

Can anyone offer any advice?



Dear All,

I would like to print a spreadsheet to a network printer. The problem is that the user does not have the printer in his list of printers. I need to add the printer e.g "printserverhidden_printer" using VBA, print the file to it, and then delete the printer. This is a special printer, and i only want the users to print this worksheet to it.

Many thaks for your time.

I have made a worksheet containing multiple commandbuttons of which one is used to print a part of the active worksheet. The code behind the commandbutton works. It is just incredible slow. The printing starts only after about 20sec. When I ran the code in the vba editor I found out that every line in the listing that is concerned with printer settings is run very slowly. The lines in the listing that have nothing to do with printersettings run with the speed of light. Does anyone has met the same problem or knows the solution? NB: The printersettings are located in a module, not in the private sub of the commandbutton.

I have created a VBA program in Excel that is fairly complex... the program basically graphs and reformats data that has been imported into excel and also retrieves information from an Access database and places this data near the title of the charts.

A few other people in the company are going to be using this program so I have two questions:

1) Since we use network printers, the name of the printer in the code, for example

Application.ActivePrinter = "ABCDEFGA123456 on Ne05:" 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
, changes depending on the computer it is installed on (my computer might say "... on Ne05" and another co-worker may have "...on Ne03")... also with different versions of Excel rolled out every few years the complete printer names also change. How can I make this program more robust so a VB error message doesn't pop up, scare the user, and prevent the program from continuing? Is there a way for a function in VB to automatically find the printers installed on the machine and select the most appropriate one or have the user select the printer?

2) In addition, there is a copy of an Excel workbook called "Personal.xls" in my Startup folder that opens everytime I run Excel... in this workbook (Personal.xls) I have the modules with code.. what is the best and easiest way to distribute this code for other users? Giving them a copy of Personal.xls and explaining how to place in the startup folder seems kind of clumsy. Also the code executes using the shortcut ctrl-a, which a normal user may not figure out...

Thanks in advance,

Hey is there i way i can customise a couple different chart fill varying by color ?? Because i would like to see color in a pie chart yet when i print it in a black and white printer it is giving me the same black nad white shade but i wouldn't want to do it manually for each different chart each time ... i know i can specify a certain chart fill color in Tool --> Options --> Color but i couldn't find a way to specify the fill patterns if that's not a possibility are there code that could do that just generate random patterns would do thanks

Hi Everyone,

I have a small problem, I would like to read data from the printer port and rechannel it back to be loged on to an excel file.
I have a program that generates information periodically and prints it on a log sheet it however does not have an option to save this data on a file, I tried to set my print driver to print to a file but it creates a seperate file each time it saves, I would like to have this data in a single excel file for archiving purposes, is it possible to do this programatically?


Two questions in one here. How do I stop excel asking do I want to overwrite another file and make it just save away?
Also on this note, anyway to make filenames, dyanmic by having a string part and then say the days date? This is for the .saveas method!!

Next question, is how can I set a print area and pop up the print box, showing printer selection options, as well as the other print options like number of pages? The macro recorder doesnt allow you to stop at that point!! Any help would be greatly appreciated.

Hi guys, I need a command button on a sheet that upon click marks column A and open the 'Search'-window with "Search in - values" as default.

New to Command Buttons so... :-)
Anyone who have any ideas.

Another question as well. I have a worksheet that is printed frequently - and it is printed on a color printer that manages duplex. But for each time I have to go to 'Advanced setting' choose paper source, duplex ('side binding' and if it should be printed in black/white or color.

Is it possible to use VBA/Command to choose the specific printer and settings?

Morning to you all,

Need this urgently--would greatly appreciate any help:

Using an Excel macro I wish to find the default printer and test for a successful connection prior to executing:

.PrintOut Copies:=1 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines

I'm having problems with the code below. It works perfectly i.e. CountGreen variable shows correct value in the message box when I step through the procedure but shows zero when the procedure is run normally. Any suggestions?

CountGreen = WorksheetFunction.Sum(Worksheets("PrintList").Range("F3:F53"))
MsgBox "Load GREEN labels into printer" & vbCr & vbCr & _
CountGreen & " labels required", vbExclamation


Is there a simple way of selecting the upper tray of a printer prior to printing from within a VBA procedure?
Any suggestions appreciated.

No luck finding an answer? You could always try Google.