RompStar
06-01-2005, 02:03 PM
Here is a script that I found on the internet, I modified it very slightly....
The script works, but...
If I run the script the Input Box comes up..., if I continue on, it's all good, but if i change my mind and press cancel I get this error:, it bugs me that there is an error, would like to figure it out, but my knowhow is still limited, I am in the progress of learning...
The error is:
Run-time error '424'; Object required... :dunno
Sub rPrint()
' Works from the sheet module that it is to work from.
Dim myRange As Range
With ActiveSheet.PageSetup
.PrintTitleRows = "$9:$9" ' where my headers are at
.PrintTitleColumns = ""
End With
Worksheets("Master").Activate
Set myRange = Application.InputBox( _
Prompt:="Select a Range to print!" & Chr(13) & Chr(13) & "Use your mouse!" & Chr(13) _
& "For more than one Range add a ""comma"" between your selected Ranges!", Type:=8)
myRange.Select
MsgBox "Ready to print: " & Selection.Address
ActiveSheet.PageSetup.PrintArea = Selection.Address
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Master").Range("A1").Select
End Sub
The script works, but...
If I run the script the Input Box comes up..., if I continue on, it's all good, but if i change my mind and press cancel I get this error:, it bugs me that there is an error, would like to figure it out, but my knowhow is still limited, I am in the progress of learning...
The error is:
Run-time error '424'; Object required... :dunno
Sub rPrint()
' Works from the sheet module that it is to work from.
Dim myRange As Range
With ActiveSheet.PageSetup
.PrintTitleRows = "$9:$9" ' where my headers are at
.PrintTitleColumns = ""
End With
Worksheets("Master").Activate
Set myRange = Application.InputBox( _
Prompt:="Select a Range to print!" & Chr(13) & Chr(13) & "Use your mouse!" & Chr(13) _
& "For more than one Range add a ""comma"" between your selected Ranges!", Type:=8)
myRange.Select
MsgBox "Ready to print: " & Selection.Address
ActiveSheet.PageSetup.PrintArea = Selection.Address
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Master").Range("A1").Select
End Sub