Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having a bit of trouble with this code, it is causing a runtime error
1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
SixDigit = InputBox("How many print-outs do you want?", " ", "2") If IsNumeric(SixDigit) Then ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for that
Greg "Chip Pearson" wrote in message ... Try SixDigit = InputBox("How many print-outs do you want?", " ", "2") If IsNumeric(SixDigit) Then ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this will do it (un-tested):
ActiveWindow.SelectedSheets.PrintOut Copies:=Val(Trim(SixDigit)), Collate:=True RBS "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim SixDigit As String
SixDigit = InputBox("How many print-outs do you want?", " ", "2") If SixDigit < "" Then ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End If -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try
SixDigit = InputBox("How many print-outs do you want?", " ", "2") if sixdigit=false then exit sub -- Don Guillett SalesAid Software "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Greg, I used the more complex type of inputbox which allows you to specify input type (in this case "1" allows only numeric input). Dim SixDigit As Long SixDigit = Application.InputBox("How many print-outs do you want?", Type:=1, Default:=2) If SixDigit 0 Then ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End If End Sub -- hth, Doug "Greg B" wrote in message ... I am having a bit of trouble with this code, it is causing a runtime error 1004, when the cancel button is hit on the input box. How can I correct the code below? Dim SixDigit As String SixDigit = InputBox("How many print-outs do you want?", " ", "2") ActiveWindow.SelectedSheets.PrintOut Copies:=SixDigit, Collate:=True End Sub Thanks Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
run code on opening workbook and apply code to certain sheets | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |