Save file, refer filename to cell and change directory

G

Guest

Hi

I have the following macro to change my filename

Sub save_with_cell(
Dim fnam
fname = Worksheets("General info").Range("C47").Value & "#" & Range("C26").Valu
fname = fname & ".xls
ActiveWorkbook.SaveAs Filename:=fnam
End Su

I want also get my file saved in a specific folder in a other directory. Can anybody tell me how to do that
 
F

Frank Kabel

Hi
try

Sub save_with_cell()
Dim fname
Dim path
path "C:\temp\"
fname = Worksheets("General info").Range("C47").Value
& "#" & Range("C26").Value
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=path & fname
End Sub
-----Original Message-----
Hi,

I have the following macro to change my filename.

Sub save_with_cell()
Dim fname
fname = Worksheets("General info").Range("C47").Value & "#" & Range("C26").Value
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=fname
End Sub

I want also get my file saved in a specific folder in a
other directory. Can anybody tell me how to do that
 
G

Guest

Hi Frank

It didn't work. I got the message "Compile error: Expected Sub, function or property" and the word path is marked yellow
----- Frank Kabel wrote: ----

H
tr

Sub save_with_cell(
Dim fnam
Dim pat
path "C:\temp\
fname = Worksheets("General info").Range("C47").Value
& "#" & Range("C26").Valu
fname = fname & ".xls
ActiveWorkbook.SaveAs Filename:=path & fnam
End Su
-----Original Message----
Hi
Dim fnam
fname = Worksheets("General info").Range("C47").Value & "#" & Range("C26").Valu
fname = fname & ".xls
ActiveWorkbook.SaveAs Filename:=fnam
End Su
other directory. Can anybody tell me how to do tha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top