Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using string value as part of SaveAs directory path

Status
Not open for further replies.
Dec 9, 2002
29
0
0
US
I have a macro to save the summary sheet of a workbook. Is there a way to incorporate a string value as part of the directory path in the SaveAs command?

I trying variations on

Dim Projtype As String
Dim Projname as string
Sheets("Summary").Select
Projtype = Range("C3")
Projname = Range("C4")
ActiveSheet.saveas Filename:="C:\_Projects\" & Projtype & Projname &".xls",

and other attempts.

The Directory "C:\_Projects\" contains subdirectories matching the projtype value, like 'retail', 'seismic', 'residential', etc.

Either the file is saved with the string 'projtype' as part of the file name, or I error out with a 'Directory path not found'.

Any suggestions?
 
Hi,

You’re missing a
ActiveSheet.saveas Filename:="C:\_Projects\" & Projtype & "\" & Projname &".xls",



Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top