PDA

Click to See Complete Forum and Search --> : VB for excel


Norah
Mar 20th, 2004, 03:16 PM
I am using VB for Excel. I wrote a program (code) with no problems except this: I want to open an excel workbook whose name I want to introduce as data, for it changes each time I use the program. I tried various alternatives, but all failed.

TheFIDDLER
Mar 21st, 2004, 01:53 PM
Does this help?


Dim stFileName as string
stfilename = (reference a cell, or reference your filename)
Workbooks.Open FileName:=stFileName


Depending on how you store your file name, you might have to build up your path string with something like:
stfilename = "c:\" & stfilename & ".xls"


If not, post what you have and we'll take a look at it.