Syntax for Workbooks.Open with a Variable + String

D

Dennis

Using XL 2003 & 97

Would like to use a variable (WBPath) for the file path, and add to it, a
filename and use all of it to open a workbook. I am simplifying the data
below - meaning that I need to use a variable for the path.

.........
.........
Dim WBPath As String
WBPath = Workbooks("myFile.xls").Path
.........
.........
(Cannot get the correct syntax for the following:)

Set OldWkbk = Workbooks.Open(Filename:=WBPath & "myFile.xls")
.........
.........

TIA for your time and knowledge,

Dennis
 
K

kkknie

Maybe you just need the \

Set OldWkbk = Workbooks.Open(Filename:=WBPath & "\myFile.xls")

K
 
B

bt

Hey, whats up. I just found this website. I am looking for some help with
Excel and I saw your reply to someone else's problem and looks like you might
be able to help me. I am sorry i am sending this in a reply, but for some
reason it won't let me start a new thread. Anyway here is my problem. I
have a very simple worksheet which consist of a column of 7 cells. Each of
these cells contain an abbreviation. What I need excel to do, is look in the
column and find a certain abbreviation and place the corresponding word in
the cell right next to that abbreviation. There is a possibilty of 30
abbreviations that are randomly put into any of the 7 cells, so Excel needs
to be able to find any abbreviation in any 1 of the 7 cells and then place
its corresponding word next to it. Can this be done? If so please help me.
You can email me at (e-mail address removed)
Thanks
 

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