Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have a Dialog box which contains 3 Check Boxes & 2 Buttons. I am using this code to bring up the Dialog. Sub Dialog() ' DialogSheets("Dialog1").Show End Sub The 3 Check Boxes place a TRUE or FALSE in specific cells depending on if the box is checked and the 2 Buttons are PRINT & Cancel. I have assigned this code to the PRINT button. Sub PRNT() ' Sheets("Sheet2").Select If Range("A1") = True Then MyString = Sheets("Sheet1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Else: Sheets("Sheet2").Select Range("A1").Select End If If Range("A2") = True Then MyString = Sheets("Sheet2").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Else: Sheets("Sheet2").Select Range("A1").Select End If If Range("A3") = True Then MyString = Sheets("Sheet3").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Else: Sheets("Sheet2").Select Range("A1").Select End If MsgBox "All checked boxes have been printed." End Sub The problem comes when any of the Check Boxes is checked and the above macro is activated by clicking PRINT in the Dialog. I get; Method 'PrintOut' of object 'Sheets' failed I've looked at all of the attributes I know of, which is admittedly few, and tried finding a solution via MS Help to no avail. Can some one help me with this? I want to be able to print only the selected sheets based on which Check Box has a check in it by clicking my PRINT Button in my Dialog. Thank you for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Giving me a error ( =REF! ) | Excel Worksheet Functions | |||
Error using a combo box with an assigned macro in Excel | Excel Worksheet Functions | |||
Error using a combo box with an assigned macro in Excel | Excel Discussion (Misc queries) | |||
Macro giving runtime error on one PC and not another | Excel Programming | |||
Macro giving runtime error on one PC and not another | Excel Programming |