Rather than hard code a file name to be used within vba. I want to type in filename in A13. Then use this filename for the "SourceFile" can this be done? I'm having no luck hacking at it?
Dim wbkS As Workbook
Dim SourceFile As String
Dim DestinationFile As String
SourceFile = "Series7_B.xlsm"
Is it possible to prompt or open up a window and path to the file name?
- Edited by texastwostep Monday, October 07, 2013 6:40 AM
Yes it is possible. Let's say the file name is stored in Cell A13 of Sheet1 then you can use the below
sPath = "C:\Folder\" SourceFile = sPath & wbkS.Sheets("Sheet1").Range("A13").Value
Regarding your other question
"Is it possible to prompt or open up a window and path to the file name?"
Which path are you referring to? Not sure if you are referring to "Application.GetOpenFilename" or "Application.GetSaveAsFilename"
That code should work :)
Ok few questions
1. Where are you running the code from? Within Excel? Automating Excel from some other application?
2. The sPath values and the "Sheet1" are values given by me to explain the process. Did you replace them with your actual values?
3. What is the value of Cell A13?
- Edited by Siddharth RoutMVP, Moderator Wednesday, October 09, 2013 5:33 AM