Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Form Creation

I'm unsure how to proceed with the following task:
What I'd like to do is to create a class that can if needed create and
display an Excel Userform. I've tried adding a reference to the Forms Object
Library and then creating an object reference of type Userform in my class,
e.g.

dim frmMyForm as Userform

The compiler accepts that but does not accept:

Set frmMyForm = New Userform

In addition, Intellisense does not offer a Show method for frmMyForm
generating an error if I write

Public Sub ShowMyForm()
frmMyForm.Show
End Sub

Can anyone point me to a source of enlightenment?

Thanks
William


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form Creation

Why not just create a custom userform (set name to frmMyForm as an example)
complete with event code and so forth, then you can do: (The code module
associated with a userform is already a class module).


Sub ABC()
Dim frm As frmMyForm
Dim frm1 As frmMyForm
Set frm = New frmMyForm
Set frm1 = New frmMyForm
frm.Caption = "ABCD"
frm1.Caption = "EFGH"
frm.Show
frm1.Show
End Sub


--
Regards,
Tom Ogilvy


"William Barnes" wrote in message
...
I'm unsure how to proceed with the following task:
What I'd like to do is to create a class that can if needed create and
display an Excel Userform. I've tried adding a reference to the Forms

Object
Library and then creating an object reference of type Userform in my

class,
e.g.

dim frmMyForm as Userform

The compiler accepts that but does not accept:

Set frmMyForm = New Userform

In addition, Intellisense does not offer a Show method for frmMyForm
generating an error if I write

Public Sub ShowMyForm()
frmMyForm.Show
End Sub

Can anyone point me to a source of enlightenment?

Thanks
William




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Form Creation

Well, I guess what I had in mind was to be able to create a class that could
be more or less self-contained, i.e., not dependent upon other files such as
the file associated with the independently created Userform. I guess there's
not really a good way to do this with VBA. Even if you write code using the
VBIDE reference, you still have to create a separate Userform object within
the VBAProject.
Thanks
William

"Tom Ogilvy" wrote in message
...
Why not just create a custom userform (set name to frmMyForm as an
example)
complete with event code and so forth, then you can do: (The code module
associated with a userform is already a class module).


Sub ABC()
Dim frm As frmMyForm
Dim frm1 As frmMyForm
Set frm = New frmMyForm
Set frm1 = New frmMyForm
frm.Caption = "ABCD"
frm1.Caption = "EFGH"
frm.Show
frm1.Show
End Sub


--
Regards,
Tom Ogilvy


"William Barnes" wrote in message
...
I'm unsure how to proceed with the following task:
What I'd like to do is to create a class that can if needed create and
display an Excel Userform. I've tried adding a reference to the Forms

Object
Library and then creating an object reference of type Userform in my

class,
e.g.

dim frmMyForm as Userform

The compiler accepts that but does not accept:

Set frmMyForm = New Userform

In addition, Intellisense does not offer a Show method for frmMyForm
generating an error if I write

Public Sub ShowMyForm()
frmMyForm.Show
End Sub

Can anyone point me to a source of enlightenment?

Thanks
William






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Form Creation

It sounds to me that you are referring to a VB executable that would then do
stuff with Excel via automation. You still have the same issue with the form
though and would be better to create the form in the VB project.

In Excel, you could create an add-in with a form class and do your stuff
from there, but it is a bit difficult trying to guess what your objective
really is.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"William Barnes" wrote in message
...
Well, I guess what I had in mind was to be able to create a class that

could
be more or less self-contained, i.e., not dependent upon other files such

as
the file associated with the independently created Userform. I guess

there's
not really a good way to do this with VBA. Even if you write code using

the
VBIDE reference, you still have to create a separate Userform object

within
the VBAProject.
Thanks
William

"Tom Ogilvy" wrote in message
...
Why not just create a custom userform (set name to frmMyForm as an
example)
complete with event code and so forth, then you can do: (The code

module
associated with a userform is already a class module).


Sub ABC()
Dim frm As frmMyForm
Dim frm1 As frmMyForm
Set frm = New frmMyForm
Set frm1 = New frmMyForm
frm.Caption = "ABCD"
frm1.Caption = "EFGH"
frm.Show
frm1.Show
End Sub


--
Regards,
Tom Ogilvy


"William Barnes" wrote in message
...
I'm unsure how to proceed with the following task:
What I'd like to do is to create a class that can if needed create and
display an Excel Userform. I've tried adding a reference to the Forms

Object
Library and then creating an object reference of type Userform in my

class,
e.g.

dim frmMyForm as Userform

The compiler accepts that but does not accept:

Set frmMyForm = New Userform

In addition, Intellisense does not offer a Show method for frmMyForm
generating an error if I write

Public Sub ShowMyForm()
frmMyForm.Show
End Sub

Can anyone point me to a source of enlightenment?

Thanks
William








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
form creation Roy Gudgeon[_2_] Excel Discussion (Misc queries) 1 March 4th 10 12:59 PM
Form Creation in Excel 2007 Stan Clawson Excel Discussion (Misc queries) 2 March 19th 07 06:10 PM
Macro for Multiple Form Creation JB2010 Excel Discussion (Misc queries) 1 March 23rd 06 03:56 PM
form creation Peter Bailey[_2_] Excel Programming 4 November 7th 04 08:23 PM
Can Excel use as a VB form creation? tanks1308[_3_] Excel Programming 5 August 17th 04 04:49 PM


All times are GMT +1. The time now is 03:07 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"