Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default userform in a separate workbook?

Gary,

You can't access forms directly from another workbook. First,
change the name of the project that contains the form from the
default 'VB Project' to something unique like 'FormProj' (to
change the name, go to the Tools menu in the VBA Editor, choose
'VB Project Properties' and in the dialog that pops up, change
the name to FormProj).

If all you need to do is show the form (but not access the
controls on the form), put the following procedure in the
workbook that contains the form.

Public Sub ShowTheForm()
UserForm1.Show
End Sub

Then, in the calling workbook, call this procedure with code like

FormProj.ShowTheForm

This will display the form, but you won't be allowed to change
its properties or read the value of its controls.

If you need more control over the form, put the following
procedure in the project containing the form:

Public Function GetForm() As UserForm1
Set GetForm = New UserForm1
End Function

Then, in the calling workbook, use code like the following:

Dim UF As Object
Set UF = FormProj.GetForm
UF.Caption = "Hello World"
UF.Show

In all cases above, change 'Userform1' to the name of your form.



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com










"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
would putting a userform in a separate workbook cause any
issues in this scenario? the workbook would only contain the
form.

there are about 20 identical workbooks, with a sheet for each
month. there is only one workbook open at a time and only the
manager enters data into the workbook.

i was just thinking i could call the form from whatever
workbook is open, enter the data, save the workbook and then
load the next workbook.
the form only enters data on the active sheet, so for ease of
management, just wondering if this is a viable solution.
--


Gary





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
Range name in separate workbook Arun Excel Discussion (Misc queries) 0 November 30th 06 08:42 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
workbook sheets into separate files markx Excel Worksheet Functions 1 June 28th 05 04:02 PM
Issuing macro in workbook from separate workbook Nigel Excel Discussion (Misc queries) 1 May 16th 05 05:46 PM
Using the same variable in separate userform modules DarrenW Excel Programming 2 July 11th 03 03:11 AM


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