ronnockoch
New Member
- Joined
- Jun 9, 2014
- Messages
- 13
Hello again,
Back again with another problem.
In brief: What I'm trying to do is open a workbook in a set directory (user inputted, but that's not the problem right now). The workbook location is inputted via a filedialogue box.
I need to open the workbook, activate it, do stuff to it (Copy data out of it specifically) then close it.
I'm running into problems after I open it and try to activate it.
While I have the workbook location, I don't have the name figured out on my end in the code because it always changes.
What would be the best way to get the workbook name? Would it be through string manipulation? (instr) or is there a simpler way.
Here's what I thought to start, but it doesn't seem to work like as i would like.
Let me know if you need me to clarify anything
Back again with another problem.
In brief: What I'm trying to do is open a workbook in a set directory (user inputted, but that's not the problem right now). The workbook location is inputted via a filedialogue box.
I need to open the workbook, activate it, do stuff to it (Copy data out of it specifically) then close it.
I'm running into problems after I open it and try to activate it.
While I have the workbook location, I don't have the name figured out on my end in the code because it always changes.
What would be the best way to get the workbook name? Would it be through string manipulation? (instr) or is there a simpler way.
Here's what I thought to start, but it doesn't seem to work like as i would like.
Code:
source = "...\SourceDirectory\File.xlsx"
Workbooks.Open filename:=Source
Workbooks(Source).Activate '' This is where I know the code errors, because it's trying to activate a workbook with name "...\SourceDirectory\File.xlxs"
Workbooks(Source).Close '' I'm assuming this also would have to be the filename and not the path
Let me know if you need me to clarify anything
Last edited: