Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default form object doesn't have a show method ?

hello !

I have a userform for which I want to programmatically set/change
properties in a function before displaying it.

Instead of hardcoding the form's name at many places in the function,
I'd like to assign it to a form object and use this object in my
function.

How can I do it ?

I tried :

Dim frm AS MSForms.UserForm
Set frm = frmActualFormName

Using this syntax, I can access and edit form's controls, but when the
program reaches :
frm.Show

I get an error 438 : Object doesn't support this property or method.

Why ?

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default form object doesn't have a show method ?

Try using the VBA.UserForms object. For example,

Sub AAA()
ShowAnyForm "frmMyForm2"
End Sub

Sub ShowAnyForm(FormName As String)
Dim N As Long
With VBA.UserForms
N = .Count
.Add FormName
.Item(N).Show
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Michel S." wrote in message
...
hello !

I have a userform for which I want to programmatically set/change
properties in a function before displaying it.

Instead of hardcoding the form's name at many places in the function, I'd
like to assign it to a form object and use this object in my function.

How can I do it ?

I tried :

Dim frm AS MSForms.UserForm
Set frm = frmActualFormName

Using this syntax, I can access and edit form's controls, but when the
program reaches :
frm.Show

I get an error 438 : Object doesn't support this property or method.

Why ?

Thanks.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default form object doesn't have a show method ?

try

Dim frm AS Object

that worked for me.

Userform is a generic class, when you create a new userform, it is its own
type.

assume the form is show in the project explorer as MyForm

then you could use

Dim frm as Myform

that will also work.

--
regards,
Tom Ogilvy



"Michel S." wrote in message
...
hello !

I have a userform for which I want to programmatically set/change
properties in a function before displaying it.

Instead of hardcoding the form's name at many places in the function, I'd
like to assign it to a form object and use this object in my function.

How can I do it ?

I tried :

Dim frm AS MSForms.UserForm
Set frm = frmActualFormName

Using this syntax, I can access and edit form's controls, but when the
program reaches :
frm.Show

I get an error 438 : Object doesn't support this property or method.

Why ?

Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default form object doesn't have a show method ?

Thanks !

I used the second method to benefit from Intellisense working too;
since the two lines :

Dim frm AS MyForm
Set frm = MyForm

are one below the other, it will be easy to change, if ever required.


Tom Ogilvy avait énoncé :
try

Dim frm AS Object

that worked for me.

Userform is a generic class, when you create a new userform, it is its own
type.

assume the form is show in the project explorer as MyForm

then you could use

Dim frm as Myform

that will also work.

--
regards,
Tom Ogilvy

"Michel S." wrote in message
...
hello !

I have a userform for which I want to programmatically set/change
properties in a function before displaying it.

Instead of hardcoding the form's name at many places in the function, I'd
like to assign it to a form object and use this object in my function.

How can I do it ?

I tried :

Dim frm AS MSForms.UserForm
Set frm = frmActualFormName

Using this syntax, I can access and edit form's controls, but when the
program reaches :
frm.Show

I get an error 438 : Object doesn't support this property or method.

Why ?

Thanks.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default form object doesn't have a show method ?

Thanks for your reply.

Your method works, but I prefer the suggestion made by Tom Ogilvy where
you only need to change the Dim statement.


Chip Pearson vient de nous annoncer :
Try using the VBA.UserForms object. For example,

Sub AAA()
ShowAnyForm "frmMyForm2"
End Sub

Sub ShowAnyForm(FormName As String)
Dim N As Long
With VBA.UserForms
N = .Count
.Add FormName
.Item(N).Show
End With
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Michel S." wrote in message
...
hello !

I have a userform for which I want to programmatically set/change
properties in a function before displaying it.

Instead of hardcoding the form's name at many places in the function, I'd
like to assign it to a form object and use this object in my function.

How can I do it ?

I tried :

Dim frm AS MSForms.UserForm
Set frm = frmActualFormName

Using this syntax, I can access and edit form's controls, but when the
program reaches :
frm.Show

I get an error 438 : Object doesn't support this property or method.

Why ?

Thanks.




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
438 - Object doesn't support this property or method Revtim Excel Programming 0 September 12th 05 09:09 PM
Object doesn't support this method Andibevan[_4_] Excel Programming 3 September 1st 05 10:07 AM
Union method for Range Object Chad Excel Programming 5 March 10th 05 08:02 PM
Unsupported object or method... mjack003[_12_] Excel Programming 2 February 10th 04 06:57 PM
Method ~ of Object ~ Failed. Joan Excel Programming 5 August 26th 03 08:13 PM


All times are GMT +1. The time now is 04:13 AM.

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"