Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
Does any one help me why I can't refer to the form with this method in VBA
Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
Your code works fine for me. Exactly what problem do you
encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
I have four forms: form1, form2, form3 and form4
when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
Hi Chip,
It seems to me that ActiveWorkbook.VBProject.VBComponents("formName") doesnt calls the initialize event of the form. Thanks "VJ" wrote: I have four forms: form1, form2, form3 and form4 when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
ActiveWorkbook.VBProject.VBComponents("forename") doesn't calls
the initialize event of the form. No it doesn't. Why would you think it would? From your earlier reply, it seems to me you don't need to use the VBProject object at all. What, exactly, are you trying to do? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Hi Chip, It seems to me that ActiveWorkbook.VBProject.VBComponents("formName") doesnt calls the initialize event of the form. Thanks "VJ" wrote: I have four forms: form1, form2, form3 and form4 when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
I need to get reference to one of the form in the workbook .
So I loop through all the forms in the workbook and I get the reference to that form whose name starts with "frm_sr". So kindly tell me how I can refer to that form dynamically. Thanks "Chip Pearson" wrote: ActiveWorkbook.VBProject.VBComponents("forename") doesn't calls the initialize event of the form. No it doesn't. Why would you think it would? From your earlier reply, it seems to me you don't need to use the VBProject object at all. What, exactly, are you trying to do? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Hi Chip, It seems to me that ActiveWorkbook.VBProject.VBComponents("formName") doesnt calls the initialize event of the form. Thanks "VJ" wrote: I have four forms: form1, form2, form3 and form4 when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
Try something like
Dim FrmName As String Dim UF As Object FrmName = "Userform1" Set UF = VBA.UserForms.Add(FrmName) UF.Caption = "Hello, World" UF.Show -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... I need to get reference to one of the form in the workbook . So I loop through all the forms in the workbook and I get the reference to that form whose name starts with "frm_sr". So kindly tell me how I can refer to that form dynamically. Thanks "Chip Pearson" wrote: ActiveWorkbook.VBProject.VBComponents("forename") doesn't calls the initialize event of the form. No it doesn't. Why would you think it would? From your earlier reply, it seems to me you don't need to use the VBProject object at all. What, exactly, are you trying to do? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Hi Chip, It seems to me that ActiveWorkbook.VBProject.VBComponents("formName") doesnt calls the initialize event of the form. Thanks "VJ" wrote: I have four forms: form1, form2, form3 and form4 when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Early and Late Binding Vba Excel
Hey Chip,
Thanks alot. it worked and really appreciate your help. Regards, "Chip Pearson" wrote: Try something like Dim FrmName As String Dim UF As Object FrmName = "Userform1" Set UF = VBA.UserForms.Add(FrmName) UF.Caption = "Hello, World" UF.Show -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... I need to get reference to one of the form in the workbook . So I loop through all the forms in the workbook and I get the reference to that form whose name starts with "frm_sr". So kindly tell me how I can refer to that form dynamically. Thanks "Chip Pearson" wrote: ActiveWorkbook.VBProject.VBComponents("forename") doesn't calls the initialize event of the form. No it doesn't. Why would you think it would? From your earlier reply, it seems to me you don't need to use the VBProject object at all. What, exactly, are you trying to do? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Hi Chip, It seems to me that ActiveWorkbook.VBProject.VBComponents("formName") doesnt calls the initialize event of the form. Thanks "VJ" wrote: I have four forms: form1, form2, form3 and form4 when click on cmdbtn on form1, form2 shows up and in the initialize event of the form2 I am getting reference to either form3 or form4 depending upon the logic. the name of the form4 is dynamic because I am importing the form4 from another workbook. I get the err in the initialize event of form2 where after getting reference to form3 or form4 I use varName.show. The varName referes to either form3 or form4 through binding. Ur help would be appreciated. Thanks "Chip Pearson" wrote: Your code works fine for me. Exactly what problem do you encounter? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "VJ" wrote in message ... Does any one help me why I can't refer to the form with this method in VBA Excel. dim var_sr_form_name as object Set var_sr_form_name = ActiveWorkbook.VBProject.VBComponents("formName") I get error when I use var_sr_form_name.show method to show the form or try to access any component of the form. Thanks in advance for ur help. VJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Late Binding examples of binding excel application | Excel Programming | |||
late binding in excel | Excel Programming | |||
VBA References - when is Office Object Library Reference set? Best practice re. Early/Late binding ... | Excel Programming | |||
EARLY binding or LATE binding ? | Excel Programming | |||
Early vs Late Binding - Word | Excel Programming |