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.
Printable View
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.
Does this help?
VB Code:
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.