Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Concatenating Variables into file path name

I can't seem to place a variable in the file path, other
than the file name at the end of the path. I've tested the
code with text rather thn the variable, but when I try to
reference a cell for a text value, I get a "cannot find
path" error. What is the syntax for adding a variable in
the middle of the path?

E.g.

ActiveWorkbook.SaveAs FileName:="E:\subfldr1\subfldr2\" &
ActiveSheet.Range("E25")& "\Subfldr4\"& stFileName
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Concatenating Variables into file path name

Ron,

First check that E25 has a valid text folder name.
Second try ActiveSheet.Range("E25").Text
Third make sure there are spaces on each side of the &
And lastly make sure your code is on a single line, or use the line
continuation symbol _

Double check by using a message box
MSGBOX "E:\subfldr1\subfldr2\" & _
ActiveSheet.Range("E25").Text & "\Subfldr4\" & stFileName
--
sb
"Ron" wrote in message
...
I can't seem to place a variable in the file path, other
than the file name at the end of the path. I've tested the
code with text rather thn the variable, but when I try to
reference a cell for a text value, I get a "cannot find
path" error. What is the syntax for adding a variable in
the middle of the path?

E.g.

ActiveWorkbook.SaveAs FileName:="E:\subfldr1\subfldr2\" &
ActiveSheet.Range("E25")& "\Subfldr4\"& stFileName



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File Path Too Long? Not Anymore! Check out Long Path Tool Max Loger Excel Discussion (Misc queries) 1 March 24th 17 07:59 AM
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Reference a file by concatenating cell variables Michael Excel Worksheet Functions 13 October 24th 08 09:54 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
Concatenating cells to produce a cell ref from another excel file ItsMeAgain Excel Worksheet Functions 1 June 24th 05 02:06 PM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"