Need help with VB Excel statement

P

programmernovice

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.
 
T

Tom Ogilvy

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.
 
P

programmernovice

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.

Thanks Tom, I appreciate it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top