Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
Hi...
I have created a macro and one of the command button with marco is to directly to print. now i need to insert a pop up (logical function) saying "u sure you want to print" and this should have 2 answers "yes" and "no" if "yes" continue with printing and if "no" cancel printing. can any one help me with this please. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
Hi
Sub MySub ...... continue=MsgBox("Are you sure you want to print it?",vbYesNo) If Not continue Then Exit Sub .... End Sub -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) "vandana" <u44172@uwe wrote in message news:858fb7a784b2d@uwe... Hi... I have created a macro and one of the command button with marco is to directly to print. now i need to insert a pop up (logical function) saying "u sure you want to print" and this should have 2 answers "yes" and "no" if "yes" continue with printing and if "no" cancel printing. can any one help me with this please. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
I think you will need the If statement to be this instead...
If continue = vbNo Then Exit Sub Rick "Arvi Laanemets" wrote in message ... Hi Sub MySub ..... continue=MsgBox("Are you sure you want to print it?",vbYesNo) If Not continue Then Exit Sub ... End Sub -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) "vandana" <u44172@uwe wrote in message news:858fb7a784b2d@uwe... Hi... I have created a macro and one of the command button with marco is to directly to print. now i need to insert a pop up (logical function) saying "u sure you want to print" and this should have 2 answers "yes" and "no" if "yes" continue with printing and if "no" cancel printing. can any one help me with this please. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
hi.. i am sorry i not very god a macro.. i am still in learning stsge.
could you tel me if i have to paste the below command in macro before are after this command whichi have for printing. ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub it may be a silly question.. tried both ways dint work.. i want a pop up saying are you sure you want to print? Rick Rothstein (MVP - VB) wrote: I think you will need the If statement to be this instead... If continue = vbNo Then Exit Sub Rick Hi [quoted text clipped - 14 lines] can any one help me with this please. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
You would put the code lines in front so it would look like this...
Sub Your Macro() ' ' Any lines of code you may have above the printout line ' Continue = MsgBox("Are you sure you want to print it?", vbYesNo) If Continue = vbNo Then Exit Sub ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub Not what will happen is the macro you are running will stop running if the user answers No. If you have other code after this and the printing is only one of many statements, then you should code it like this... Sub Your Macro() ' ' Any lines of code you may have above the printout line ' Continue = MsgBox("Are you sure you want to print it?", vbYesNo) If Continue = vbYes Then ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End If ' ' The rest of your code goes here ' End Sub Rick "vandana" <u44172@uwe wrote in message news:8591e664ae192@uwe... hi.. i am sorry i not very god a macro.. i am still in learning stsge. could you tel me if i have to paste the below command in macro before are after this command whichi have for printing. ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub it may be a silly question.. tried both ways dint work.. i want a pop up saying are you sure you want to print? Rick Rothstein (MVP - VB) wrote: I think you will need the If statement to be this instead... If continue = vbNo Then Exit Sub Rick Hi [quoted text clipped - 14 lines] can any one help me with this please. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pop up in excel
thanks a lot... it works now.. u guys are the best.
Rick Rothstein (MVP - VB) wrote: You would put the code lines in front so it would look like this... Sub Your Macro() ' ' Any lines of code you may have above the printout line ' Continue = MsgBox("Are you sure you want to print it?", vbYesNo) If Continue = vbNo Then Exit Sub ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub Not what will happen is the macro you are running will stop running if the user answers No. If you have other code after this and the printing is only one of many statements, then you should code it like this... Sub Your Macro() ' ' Any lines of code you may have above the printout line ' Continue = MsgBox("Are you sure you want to print it?", vbYesNo) If Continue = vbYes Then ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End If ' ' The rest of your code goes here ' End Sub Rick hi.. i am sorry i not very god a macro.. i am still in learning stsge. could you tel me if i have to paste the below command in macro before are [quoted text clipped - 18 lines] can any one help me with this please. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|