Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
combo box macro runs when using "save as"
I have a spreadsheet used as a form.
There is a combo box on the main page which changes the entries of other cells on other sheets dependant on the value chosen in the combo box. I am using case statements to check the value of the combo box and then change the values in other cells. The problem is that when the user uses 'Save As' the combo box_change macro runs and changes/deletes entries the user may have made according to the initial rules when the macro first ran. How do I stop this from happening? Is there a way of checking if the user has selected 'Save As' and then preventing the macro from running or is it simpler than this. Any help much appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
combo box macro runs when using "save as"
One way would be to have a global variable, set that in the BeforeSave
event if SaveAsUI is true, and test that in the combobox macro. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "ctr" wrote in message om... I have a spreadsheet used as a form. There is a combo box on the main page which changes the entries of other cells on other sheets dependant on the value chosen in the combo box. I am using case statements to check the value of the combo box and then change the values in other cells. The problem is that when the user uses 'Save As' the combo box_change macro runs and changes/deletes entries the user may have made according to the initial rules when the macro first ran. How do I stop this from happening? Is there a way of checking if the user has selected 'Save As' and then preventing the macro from running or is it simpler than this. Any help much appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
combo box macro runs when using "save as"
Makes sense but how do I set a global variable if SaveAsUI is true?
can't seem to get it to work. Thanks *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
combo box macro runs when using "save as"
Create a Public variable outside of a procedure in a standard code module,
call it say NoCombo and declare as a Boolean. In the BeforeSave event in ThisWorkbook module Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) NoCombo = Not SaveAsUI End Sub and in your combo box macro/event, add something like If Not NoCombo Then 'your code here End If You will also need to work out where in your code NoCombo gets set to False again. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "James Martin" wrote in message ... Makes sense but how do I set a global variable if SaveAsUI is true? can't seem to get it to work. Thanks *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
combo box macro runs when using "save as"
Got it working now. Thanks very much for your help. Much appreciated.
*** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 | Excel Discussion (Misc queries) | |||
Macro to Insert Current Date into cell - Macro to "Save As" | Excel Worksheet Functions | |||
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION | Excel Discussion (Misc queries) | |||
"Save" and "Save As" options greyed out - "Save as Webpage" option | Excel Discussion (Misc queries) | |||
Unprotecting 4 sheets before "WorkbookOpen" macro runs | Excel Discussion (Misc queries) |