View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_5_] GS[_5_] is offline
external usenet poster
 
Posts: 226
Default how do I link a constant or variable to form

c1802362 explained on 9/13/2011 :
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


Ok, you could have just used the declared constant instead of the cell
text. I didn't know you already had this in place (and so IS WHY I
asked you to define the posted variables). According to your
explanation, the filename is stored in a cell where users can update it
when the filename changes. Not sure why you ALSO hard code it as a
CONSTant in code since it's data is variable!


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


This would not be necessary had you put this line of code in the
Userform_Initialize event as I instructed you to do. This way, you
don't need to ref the userform because it knows itself and all the
controls on it.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc



--- Posted via news://freenews.netfront.net/ - Complaints to ---