View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
c1802362[_2_] c1802362[_2_] is offline
external usenet poster
 
Posts: 65
Default how do I link a constant or variable to form

Thanks - it works, although I was hoping to avoid the intermediate
step of writing the filename to a cell before transferring it to the
form. Right now the file name is a string constant at the head of the
VBA code, but I have a hidden sheet full of info I used per your
directions

By the way, I had to modify your syntax to:
form1.lblDataSource.Caption = Range("DataSource").Text
to get an object reference

Art


On Sep 13, 1:06*pm, GS wrote:

Assign the 'Text' of the cell containing the filename info to the
'Caption' property of the label on your userform in the form's
Initialize event.

* Example: (air code)
* * lblDataSource.Caption = Range("DataSource").Text

* ..where 'lblDataSource' is the name you give to the target label, AND
"DataSource" is the local scope name you give to the cell where the
filename resides.

* To give a named range local scope:
* * Select the range
* * In the namebox to left of the Formula Bar, type:

* * * '<sheet name'!DataSource

* * ..where <sheet name should be replaced with the actual worksheet
name

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -