#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default Print Code

I have this code
Private Sub CommandButton1_Click()
Dim TotPages As Long
Dim x As Long
Dim y As Long

TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
Sheets("Request Form").Select
With ActiveSheet.PageSetup
ActiveSheet.PrintOut From:=1, To:=1
End With
Sheets("Attendance Sheet").Select
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
End Sub

When I run it ActiveSheet.PrintOut From:=x, To:=y
it wants a range from 1- a large number. When I run this part TotPages =
Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
on the actual attendance sheet it runs fine. I am not sure what I am doing
wrong.
Thanks
Cheyenne
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Print Code

Chey

That's not the same code you posted two days ago that you said was giving the
error.

Remove the second TotPages line.

Private Sub CommandButton1_Click()
Dim TotPages As Long
Dim x As Long
Dim y As Long

TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
Sheets("Request Form").Select
With ActiveSheet.PageSetup
ActiveSheet.PrintOut From:=1, To:=1
End With
Sheets("Attendance Sheet").Select
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
End Sub


Gord

On Fri, 13 Apr 2007 11:12:03 -0700, Chey wrote:

I have this code
Private Sub CommandButton1_Click()
Dim TotPages As Long
Dim x As Long
Dim y As Long

TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
Sheets("Request Form").Select
With ActiveSheet.PageSetup
ActiveSheet.PrintOut From:=1, To:=1
End With
Sheets("Attendance Sheet").Select
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
End Sub

When I run it ActiveSheet.PrintOut From:=x, To:=y
it wants a range from 1- a large number. When I run this part TotPages =
Application.ExecuteExcel4Macro("GET.DOCUMENT(50)" )
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
on the actual attendance sheet it runs fine. I am not sure what I am doing
wrong.
Thanks
Cheyenne


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
nine digit zip code won't print in mail merge Durham Excel Discussion (Misc queries) 11 July 1st 08 12:34 PM
Print routine needed for code pano Excel Worksheet Functions 3 February 11th 07 02:27 PM
How To Print Spreadsheet Report using VBA Code [email protected] Excel Discussion (Misc queries) 1 September 4th 06 07:01 PM
Leading zero in zip code won't print J Mac Excel Discussion (Misc queries) 7 September 1st 05 12:07 AM
Code for Print Layout Phil Osman Excel Discussion (Misc queries) 1 March 31st 05 06:18 AM


All times are GMT +1. The time now is 04:49 AM.

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"