Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Print Macro Function

Can someone please help me. I am trying to create a print marcro
where I define the cell ranges I want to be included in the print area
using input boxes and set the orientation to landscape and the margins
to 0.5" on all sides. The print area is going to have non-contigous
cell references (i.e, should print multiple pages per sheet). I want
this macro to define these print attributes for all the worksheets in
my workbook. Below is the code I have come up so far but I am having
quite a bit of trouble getting this to work. Can somebody please help
me?? Would be greatly appreciated.

ub PrintMacro()
Dim ISRng As Range
On Error Resume Next
Set ISRng = Application.InputBox _
(prompt:="Specify a range:", Type:=8)
If ISRng Is Nothing Then Exit Sub
MsgBox "You selected the following range for the income statement
" & ISRng.Address

Dim BSRng As Range
On Error Resume Next
Set BSRng = Application.InputBox _
(prompt:="Specify a range:", Type:=8)
If BSRng Is Nothing Then Exit Sub
MsgBox "You selected the following range for the income statement
" & BSRng.Address

Dim PrtArea As Range

With Worksheets.PageSetup _
.PrintArea = ISRng.Address,BSRng.Address




End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Print Macro Function

add

.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1000
End With

and test it. What is it doing?

wrote:
Can someone please help me. I am trying to create a print marcro
where I define the cell ranges I want to be included in the print area
using input boxes and set the orientation to landscape and the margins
to 0.5" on all sides. The print area is going to have non-contigous
cell references (i.e, should print multiple pages per sheet). I want
this macro to define these print attributes for all the worksheets in
my workbook. Below is the code I have come up so far but I am having
quite a bit of trouble getting this to work. Can somebody please help
me?? Would be greatly appreciated.

ub PrintMacro()
Dim ISRng As Range
On Error Resume Next
Set ISRng = Application.InputBox _
(prompt:="Specify a range:", Type:=8)
If ISRng Is Nothing Then Exit Sub
MsgBox "You selected the following range for the income statement
" & ISRng.Address

Dim BSRng As Range
On Error Resume Next
Set BSRng = Application.InputBox _
(prompt:="Specify a range:", Type:=8)
If BSRng Is Nothing Then Exit Sub
MsgBox "You selected the following range for the income statement
" & BSRng.Address

Dim PrtArea As Range

With Worksheets.PageSetup _
.PrintArea = ISRng.Address,BSRng.Address

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200808/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Print Macro Function

On Aug 1, 11:27*am, "dustinbrearton via OfficeKB.com" <u44989@uwe
wrote:
add

* * .Orientation = xlLandscape
* * .Zoom = False
* * .FitToPagesWide = 1
* * .FitToPagesTall = 1000
End With

and test it. *What is it doing?





wrote:
Can someone please help me. *I am trying to create a print marcro
where I define the cell ranges I want to be included in the print area
using input boxes and set the orientation to landscape and the margins
to 0.5" on all sides. *The print area is going to have non-contigous
cell references (i.e, should print multiple pages per sheet). *I want
this macro to define these print attributes for all the worksheets in
my workbook. *Below is the code I have come up so far but I am having
quite a bit of trouble getting this to work. *Can somebody please help
me?? *Would be greatly appreciated.


ub PrintMacro()
* *Dim ISRng As Range
* * * *On Error Resume Next
* *Set ISRng = Application.InputBox _
* * * *(prompt:="Specify a range:", Type:=8)
* *If ISRng Is Nothing Then Exit Sub
* *MsgBox "You selected the following range for the income statement
" & ISRng.Address


* *Dim BSRng As Range
* * * *On Error Resume Next
* *Set BSRng = Application.InputBox _
* * * *(prompt:="Specify a range:", Type:=8)
* *If BSRng Is Nothing Then Exit Sub
* *MsgBox "You selected the following range for the income statement
" & BSRng.Address


* *Dim PrtArea As Range


* *With Worksheets.PageSetup _
* * * * * *.PrintArea = ISRng.Address,BSRng.Address


End Sub


--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200808/1- Hide quoted text -

- Show quoted text -


I am getting a "compile error: Method or data member not found"

VBA is highlighting the pagesetup object when the error pops up.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM
Call Excel Print Function, But Not Through a Macro arhythm Excel Programming 0 January 14th 04 09:37 PM


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"