Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Use a variable for a Form reference

I am developing an application in Excel and need to allow for multiple screen
sizes. I have been referred to an article by Tom Ogilvy back in 2004 that
describes how to determine the screen resolution and from their differing
User Forms based on that screen resolution can be shown.

I have a number of routines that validate and initilise the data in the form
that will basically be duplicated unless I can find a way to use a parameter
for the Form name....

For example....instead of the code below explicity referring to the
VendorEntry_1280x1024 form I want to be able to use a variable that is passed
into the routine for all screen resolutions.....is that possible ?

The error that is returned when I try and use a variable is..."compile
error: invalid qualifer"


Public Sub RefreshVendorDataEntry_1280x1024()
'Routine only used to refresh the values in the list box

'Remove any selection within the List Box
VendorEntry_1280x1024.VendorDataListBox.ListIndex = -1
VendorEntry_1280x1024.VendorSalesStaffMember.ListI ndex = -1



Any help appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Use a variable for a Form reference

I am not sure if my interpretation of what you are trying to achieve is
correct. However, the following assigns a form to a variable and passes it to
another procedure to initialize text boxes.

Sub Calling_Sub()
Dim VendorEntry_1280x1024
Set VendorEntry_1280x1024 = UserForm1
Call Init_Txt_Boxes(VendorEntry_1280x1024)
End Sub


Sub Init_Txt_Boxes(myParam)
myParam.VendorDataListBox.ListIndex = -1
myParam.VendorSalesStaffMember.ListIndex = -1
myParam.Show
End Sub


--
Regards,

OssieMac


"scott56hannah" wrote:

I am developing an application in Excel and need to allow for multiple screen
sizes. I have been referred to an article by Tom Ogilvy back in 2004 that
describes how to determine the screen resolution and from their differing
User Forms based on that screen resolution can be shown.

I have a number of routines that validate and initilise the data in the form
that will basically be duplicated unless I can find a way to use a parameter
for the Form name....

For example....instead of the code below explicity referring to the
VendorEntry_1280x1024 form I want to be able to use a variable that is passed
into the routine for all screen resolutions.....is that possible ?

The error that is returned when I try and use a variable is..."compile
error: invalid qualifer"


Public Sub RefreshVendorDataEntry_1280x1024()
'Routine only used to refresh the values in the list box

'Remove any selection within the List Box
VendorEntry_1280x1024.VendorDataListBox.ListIndex = -1
VendorEntry_1280x1024.VendorSalesStaffMember.ListI ndex = -1



Any help appreciated

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
How to reference variable worksheets and variable row glenn[_3_] Excel Programming 3 September 29th 07 02:44 PM
Pass variable from form to form to form headly Excel Programming 1 May 31st 06 02:50 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM
Variable Reference to a Form Control Sharlene England Excel Programming 2 November 5th 04 10:56 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM


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