Home |
Search |
Today's Posts |
#5
![]() |
|||
|
|||
![]()
Bob
Thanks for your patience. Just wanted to let you know that your help has resolved my problem - very much appreciated. David "Bob Phillips" wrote in message ... I repeat ... Create public variables store them in the macro module in the declarations, before the macro ... the variable should be defined before the macro not within it when you make it public. To load them in the form just means assign a value to that variable. MODULE Public myVar as String Sub Macro1() Msgbox myVar End Sub FORM Private Sub CommandButton1_Click() myVar = "testing" Unload Me End Sub -- HTH Bob Phillips "David" wrote in message ... Thank you for your response. I'm being a bit thick here and need to ask what may be obvious. I used the word Public instead of Dim at the beginning of the macro, where I declare the variables but get 'Invalid attribte in Sub or Function'. I'm not sure how to create public variables in the macro and how to load them from within the form. I have a simple form with Initialise and Click subroutines. I'm trying to gather data from the form to use in the macro. Thanks David "Bob Phillips" wrote in message ... Create public variables store them in the macro module in the declarations, before the macro, and load them from within the form. -- HTH Bob Phillips "David" wrote in message ... Hi I have a working Excel VBA macro and would like to use a form for all the inputs. I have the form and the code behind the text/combo boxes etc. I just don't know how to call the form so that the data collected is passed to the variables in the main macro. I searched for this information but can only find info on creating the form rather than having it run with a macro. I'd appreciate any info, links etc. It would be great if you could point me to an example form with all the suurounding code, declarations etc. Can the form be used for the output of the macro? Thanks David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing variables between a form and macro | New Users to Excel | |||
Display form from an VB application in Excel | Excel Discussion (Misc queries) | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions | |||
2 part question - macro / command button | Excel Discussion (Misc queries) | |||
Attaching a macro to a VB button on a form | Excel Worksheet Functions |