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

How do I reference a form that is located in an add-in xla file? The name of
the xla file is dailymods.xla so I tried:
dailymods.userform2.show
but it doesn't work. Ideas?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Form In .xla file

Is the form opened?

try something like this
workbooks.open filename:=dailymods.xla 'include path if necessary
set frm = ActiveWorkbook 'reference for by this name or
'Workbooks("dailymods.xls")
'when using workbooks don't include
path

"Mike H." wrote:

How do I reference a form that is located in an add-in xla file? The name of
the xla file is dailymods.xla so I tried:
dailymods.userform2.show
but it doesn't work. Ideas?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Form In .xla file

I tried this but it doesn't work:
Set Frm = Workbooks("dailymods.xla")
Frm.UserForm1.Show

I am not sure I am understanding your suggestion.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Form In .xla file

In your dailymods.xla Include a sub or function to show the form, it
probably already has one, eg

Function RunForm(a As String) As Variant
UserForm1.Caption = a
UserForm1.Show
RunForm = "Return value"
End Function

One way to call RunForm from other projects is with 'Run', eg

Sub test()
Dim s As String, res
s = "called from " & ThisWorkbook.Name
res = Application.Run("dailymods.xla!RunForm", s)
MsgBox res
End Sub

Regards,
Peter T



"Mike H." wrote in message
...
How do I reference a form that is located in an add-in xla file? The name

of
the xla file is dailymods.xla so I tried:
dailymods.userform2.show
but it doesn't work. Ideas?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Form In .xla file

That worked! Thanks.

"Peter T" wrote:

In your dailymods.xla Include a sub or function to show the form, it
probably already has one, eg

Function RunForm(a As String) As Variant
UserForm1.Caption = a
UserForm1.Show
RunForm = "Return value"
End Function

One way to call RunForm from other projects is with 'Run', eg

Sub test()
Dim s As String, res
s = "called from " & ThisWorkbook.Name
res = Application.Run("dailymods.xla!RunForm", s)
MsgBox res
End Sub

Regards,
Peter T



"Mike H." wrote in message
...
How do I reference a form that is located in an add-in xla file? The name

of
the xla file is dailymods.xla so I tried:
dailymods.userform2.show
but it doesn't work. Ideas?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Form In .xla file

"Mike H." wrote:
How do I reference a form that is located in an add-in xla file?


In a similar vein, but a little more basic, how do you create a form in VBA,
or in Visual Studio and import it through VBA?
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
VBA open file from a form jlclyde Excel Discussion (Misc queries) 3 April 27th 10 09:23 PM
Call user form from ThisWorkbook; close file if form closed XP Excel Programming 2 July 20th 07 07:04 PM
File in 2007 form - need to get back to 2003 form... RHM Excel Discussion (Misc queries) 2 May 7th 07 05:38 AM
Open file from a form sonu[_2_] Excel Programming 5 December 1st 06 02:13 AM
Excel-Form to file.txt Hennie[_2_] Excel Programming 1 June 25th 05 11:10 AM


All times are GMT +1. The time now is 05:50 AM.

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

About Us

"It's about Microsoft Excel"