Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
What is the code I need to write in order to:
1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
1 1st page of active workBOOK
sheet1.printout 2 activesheet.range("a1:b5").printout -- Don Guillett SalesAid Software "amirstal" wrote in message oups.com... What is the code I need to write in order to: 1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
1.
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1 2. Range("A1:B5").Select Selection.PrintOut Copies:=1 Mike F "amirstal" wrote in message oups.com... What is the code I need to write in order to: 1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
Thanks. That works perfectly.
Can I also make the code choose a specific printer to print from? I want to direct the prints to a different printer than the default... Tom Ogilvy wrote: Activesheet.PrintOut From:=1, To:=1, _ Copies:=1, Collate:=True Range("A1:B5").Printout or selection.Printout -- Regards, Tom Ogilvy "amirstal" wrote: What is the code I need to write in order to: 1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
Thanks.
I could not get it to work. This is how I tried: Sub PrintBlotter() ' ' PrintBlotter Macro ' Macro recorded 12/18/2006 by Reuters LTD ' Print Application.ActivePrinter //IDB-NY509-04-TRADER-4600C ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True ' End Sub But I got the following message: Compile error: Method not valid without suitable object. Thanks, Amir Tom Ogilvy wrote: Select the printer you want. then in the immediate window to ? application.ActivePrinter for example: ? application.ActivePrinter \\ARDAPS01\1D373C on Ne03: Now use this string to set the activeprinter (of course capture the default and set it back after printing). -- Regards, Tom Ogilvy "amirstal" wrote: Thanks. That works perfectly. Can I also make the code choose a specific printer to print from? I want to direct the prints to a different printer than the default... Tom Ogilvy wrote: Activesheet.PrintOut From:=1, To:=1, _ Copies:=1, Collate:=True Range("A1:B5").Printout or selection.Printout -- Regards, Tom Ogilvy "amirstal" wrote: What is the code I need to write in order to: 1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Basic VBA Question
Still not working...
I get the following message: Run-time error '1004': Method 'ActivePrinter' of object' _Application' failed and when I hit debug, this whole line is yellow: Application.ActivePrinter = "//IDB-NY509-04-TRADER-4600C" Thanks again, Amir. Tom Ogilvy wrote: Sub PrintBlotter() ' ' PrintBlotter Macro ' Macro recorded 12/18/2006 by Reuters LTD ' ' capture current default s = Application.ActivePrinter ' set it to the desired printer Application.ActivePrinter = _ "//IDB-NY509-04-TRADER-4600C" ' Print out ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True ' Restore the default Application.ActivePrinter = s End Sub Would be my best guess based on what you show. -- Regards, Tom Ogilvy "amirstal" wrote: Thanks. I could not get it to work. This is how I tried: Sub PrintBlotter() ' ' PrintBlotter Macro ' Macro recorded 12/18/2006 by Reuters LTD ' Print Application.ActivePrinter //IDB-NY509-04-TRADER-4600C ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True ' End Sub But I got the following message: Compile error: Method not valid without suitable object. Thanks, Amir Tom Ogilvy wrote: Select the printer you want. then in the immediate window to ? application.ActivePrinter for example: ? application.ActivePrinter \\ARDAPS01\1D373C on Ne03: Now use this string to set the activeprinter (of course capture the default and set it back after printing). -- Regards, Tom Ogilvy "amirstal" wrote: Thanks. That works perfectly. Can I also make the code choose a specific printer to print from? I want to direct the prints to a different printer than the default... Tom Ogilvy wrote: Activesheet.PrintOut From:=1, To:=1, _ Copies:=1, Collate:=True Range("A1:B5").Printout or selection.Printout -- Regards, Tom Ogilvy "amirstal" wrote: What is the code I need to write in order to: 1. Print the first page of an active worksheet? 2. Print a selected range (A1:B5 for example) of an active worksheet? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Very basic VBA question. | Excel Discussion (Misc queries) | |||
Basic question | Excel Discussion (Misc queries) | |||
Basic VBA question... | Excel Programming | |||
Basic question | Excel Programming | |||
Basic VBA question | Excel Programming |