ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform in a separate workbook? (https://www.excelbanter.com/excel-programming/344484-userform-separate-workbook.html)

Gary Keramidas

userform in a separate workbook?
 
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




Bob Phillips[_6_]

userform in a separate workbook?
 
Gary,

How about an add-in?

--

HTH

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


"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






Chip Pearson

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







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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com