View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default refering to filename in VB

You will still need to know the file name (or ask the user to supply it) in
order to open the workbook. Once there can set a refernce to it and use that
through out your code. e.g.
Dim WB As Workbook
Private sub cmdOpenFile()
Dim RetVal As Variant
RetVal=Application.GetopenFileName()
If RetVal<False Then
Set WB=Workbooks.Open(RetVal)
End If
End Sub

Is that what you mean ?

NickHK

"BrownTing" ¼¶¼g©ó¶l¥ó·s»D:BrownTing.2b78t5_1153324012.5459@ex celforum-nospam.com...

Hi Guys,

From time to time, people rename files. I want to read the file name of
an open workbook and store it as a variable. Essentially, avoiding the
whole hardcoding the actual file name.


Any Ideas guys?


--
BrownTing
------------------------------------------------------------------------
BrownTing's Profile:
http://www.excelforum.com/member.php...o&userid=34919
View this thread: http://www.excelforum.com/showthread...hreadid=562913