ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with VB Excel statement (https://www.excelbanter.com/excel-programming/383248-need-help-vbulletin-excel-statement.html)

[email protected]

Need help with VB Excel statement
 
Hi, can someone please give me the syntax for Excel VB statement to
open a worksheet, which is named in "INDEX(dir, k)". In my XLM
program the statement is simply "=OPEN(dir,k)", but I can't seem to
figure out how to write it in VB. Many thanks in advance.


Tom Ogilvy

Need help with VB Excel statement
 
workbooks.Open FileName:=Dir, UpdateLinks:=k

This assume the variable Dir holds a fully qualified path with filename or
if the file is in the default directory/drive, then just the filename.

However, there is a VBA function named Dir, so you might want to use a
different variable name for this variable.

--
Regards,
Tom Ogilvy


" wrote:

Hi, can someone please give me the syntax for Excel VB statement to
open a worksheet, which is named in "INDEX(dir, k)". In my XLM
program the statement is simply "=OPEN(dir,k)", but I can't seem to
figure out how to write it in VB. Many thanks in advance.



[email protected]

Need help with VB Excel statement
 
On Feb 14, 2:10 pm, Tom Ogilvy
wrote:
workbooks.Open FileName:=Dir, UpdateLinks:=k

This assume the variable Dir holds a fully qualified path with filename or
if the file is in the default directory/drive, then just the filename.

However, there is a VBA function named Dir, so you might want to use a
different variable name for this variable.

--
Regards,
Tom Ogilvy


Thanks Tom, I appreciate it.



All times are GMT +1. The time now is 11:10 PM.

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