Seamus2626
asked on
VBA REFERENCE FORMULA EXCEL
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan -15\Output \Europe\Al l"
I want the region Europe to toggle, so on the excel spreadsheet I have a dropdown on cell M5 - how do I reference the cell M5 as opposed to hardcoding the vbal code with "Europe"
The same applies to a line I have
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
Where it says GB-Corp I would like the cell N5
Many thanks!
I want the region Europe to toggle, so on the excel spreadsheet I have a dropdown on cell M5 - how do I reference the cell M5 as opposed to hardcoding the vbal code with "Europe"
The same applies to a line I have
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
Where it says GB-Corp I would like the cell N5
Many thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Change to
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan -15\Output \" & Cells(5,13) & "\All"
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan -15\Output \" & Cells(5,"M") & "\All"
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan -15\Output \" & Cells(5,13) & "\All"
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan
ASKER
Sorry to be a pain but my VB is weak
I changed to the below and they attached nothing
stfilename1 = str & " " & Cells(15, 14) & " (Jan-15) - Managed Region .pdf"
stfilename2 = str & " " & Cells(15, 14) & " - Booked .pdf"
stfilename3 = str & " " & Cells(15, 14) & " - Managed .pdf"
Thanks
I changed to the below and they attached nothing
stfilename1 = str & " " & Cells(15, 14) & " (Jan-15) - Managed Region .pdf"
stfilename2 = str & " " & Cells(15, 14) & " - Booked .pdf"
stfilename3 = str & " " & Cells(15, 14) & " - Managed .pdf"
Thanks
I don't know what you mean by "they attached nothing".
If after those lines you have
Msgbox stfilename1
then you will see what is there.
If after those lines you have
Msgbox stfilename1
then you will see what is there.
ASKER
So line of code
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
Recognises the file in the folder and attaches
stfilename1 = str & " " & Cells(15, 14) & " (Jan-15) - Managed Region .pdf"
Does not recognise any folder in that file
Cell N5 in the drop down in excel = GB-Corp
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
Recognises the file in the folder and attaches
stfilename1 = str & " " & Cells(15, 14) & " (Jan-15) - Managed Region .pdf"
Does not recognise any folder in that file
Cell N5 in the drop down in excel = GB-Corp
Sorry - I thought you said N15.
Use cells(5,14) instead of cells(15,14).
It is in the format cells(rownumber, columnnumber).
Use cells(5,14) instead of cells(15,14).
It is in the format cells(rownumber, columnnumber).
ASKER
So I could automate the date as well I amended to
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & Cells(5, 15) & "\Output\" & Cells(5, 13) & "\All"
Where 5,15 = Jan-15 in excel
Again the vba doesn't recognise the file now
Il uplaod
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & Cells(5, 15) & "\Output\" & Cells(5, 13) & "\All"
Where 5,15 = Jan-15 in excel
Again the vba doesn't recognise the file now
Il uplaod
ASKER
You need to format the date
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & format(Cells(5, 15),"mmm-yy") & "\Output\" & Cells(5, 13) & "\All"
This outputs
R:\SPM\Horis Info\Horis_Project\GBM\Jan -15\Output \Europe\Al l
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & format(Cells(5, 15),"mmm-yy") & "\Output\" & Cells(5, 13) & "\All"
This outputs
R:\SPM\Horis Info\Horis_Project\GBM\Jan
Seamus,
This is a part of bigger code so help me understand that this path will it changes for the respective person in the next line??
In additional can you help me understand how does the path will look like??
Saurabh...
This is a part of bigger code so help me understand that this path will it changes for the respective person in the next line??
In additional can you help me understand how does the path will look like??
Saurabh...
ASKER
Hi Saurabh,
Have you opened the above file?
Have you opened the above file?
And i would use rather this code..
Since assuming this can change from person to person...
Saurabh...
Since assuming this can change from person to person...
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\" & Format(Cells(cell.Row, 15).Value, "mmm-yy") & "\Output\" & Cells(cell.Row, 13).Value & "\All"
Saurabh...
ASKER
The above works perfect Saurabh
Are you able to replicate for line
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
So GB-Corp is found in cell N5 and Jan-15 is found in cell O6
Thanks!
Are you able to replicate for line
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
So GB-Corp is found in cell N5 and Jan-15 is found in cell O6
Thanks!
For this will use...
Again the idea to use it this way is that lets say in next row if you get a new input it will pick that input rather then picking from one cell at a time...
Saurabh...
stfilename1 = str & " "& cells(cell.row,14).value & " (" & format(cells(Cell.row,15).value,"mmm-yy") & ") - Managed Region .pdf"
Again the idea to use it this way is that lets say in next row if you get a new input it will pick that input rather then picking from one cell at a time...
Saurabh...
ASKER
Sorry, I might have confused things here Saurabh
From my attached file the code ran perfectly for the first recipient Zimmer, but the other recipients received no files?
Thanks
Burst-Tool-V1.xlsm
From my attached file the code ran perfectly for the first recipient Zimmer, but the other recipients received no files?
Thanks
Burst-Tool-V1.xlsm
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys!
ASKER
Saurabh, im about to post a question relating to your code which you may be able to help me with!
ASKER
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan
Both attach no file
stpath = "R:\SPM\Horis Info\Horis_Project\GBM\Jan
stfilename1 = str & " GB-Corp (Jan-15) - Managed Region .pdf"
stfilename2 = str & " GB-Corp (Jan-15) - Booked .pdf"
stfilename3 = str & " GB-Corp (Jan-15) - Managed .pdf"
stfilename1 is blank once I change from hardcoding to above
Thanks!