ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   string variables in file names (https://www.excelbanter.com/excel-programming/366044-string-variables-file-names.html)

dr chuck

string variables in file names
 
Can i use a defined string variable in a file name when opening? if so what
is the appropriate syntax?

example....

Workbooks.Open Filename:= _
"C:\Documents and Settings\HP_Owner\Desktop\PanelSelect\panels\16-1
letterO.xls"

i want to use a string variable named "antfile" in place of the file name
16-1letterO.xls

--
dr chuck

Dave Peterson

string variables in file names
 
Yep:

dim antfile as string
antfile = "somestringhere"

Workbooks.Open Filename:= _
"C:\Documents and Settings\HP_Owner\Desktop\PanelSelect\panels\" & antfile


dr chuck wrote:

Can i use a defined string variable in a file name when opening? if so what
is the appropriate syntax?

example....

Workbooks.Open Filename:= _
"C:\Documents and Settings\HP_Owner\Desktop\PanelSelect\panels\16-1
letterO.xls"

i want to use a string variable named "antfile" in place of the file name
16-1letterO.xls

--
dr chuck


--

Dave Peterson

dr chuck

string variables in file names
 
thanks for the syntax help dave.

--
dr chuck


"Dave Peterson" wrote:

Yep:

dim antfile as string
antfile = "somestringhere"

Workbooks.Open Filename:= _
"C:\Documents and Settings\HP_Owner\Desktop\PanelSelect\panels\" & antfile


dr chuck wrote:

Can i use a defined string variable in a file name when opening? if so what
is the appropriate syntax?

example....

Workbooks.Open Filename:= _
"C:\Documents and Settings\HP_Owner\Desktop\PanelSelect\panels\16-1
letterO.xls"

i want to use a string variable named "antfile" in place of the file name
16-1letterO.xls

--
dr chuck


--

Dave Peterson



All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com