Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Late Binding examples of binding excel application HeatherO Excel Programming 13 March 17th 05 08:19 AM
late binding in excel Grey Excel Programming 3 May 22nd 04 05:15 PM
VBA References - when is Office Object Library Reference set? Best practice re. Early/Late binding ... AndyB Excel Programming 5 April 22nd 04 02:11 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
Early vs Late Binding - Word John Wilson Excel Programming 6 November 13th 03 03:21 PM


All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"