[macro VBA] save workbook cell name
Solved
BastienP
Posted messages
4
Status
Membre
-
FAB -
FAB -
Hello,
I'm looking for how to code to save my workbook with a name that would be the value of a cell (number or text) or even preferably the name of a sheet in this workbook.
I thought about defining a variable but this does not work in the code:
ActiveWorkbook.SaveAs Filename:= _
"name.xls"
If anyone has an idea for me...
Thanks and have a good evening!!
I'm looking for how to code to save my workbook with a name that would be the value of a cell (number or text) or even preferably the name of a sheet in this workbook.
I thought about defining a variable but this does not work in the code:
ActiveWorkbook.SaveAs Filename:= _
"name.xls"
If anyone has an idea for me...
Thanks and have a good evening!!
Either you put the path and the filename in 2 cells of a sheet, or in VBA variables, or you mix them.
For example, with the path in a variable and the filename in Sheet1!A1:
sub save
dim path as string
path = "C:\Users\Family MOULA\Documents\project\Eve\"
ActiveWorkbook.SaveAs Filename:=path & Worksheets("Sheet1").[A1].Value
end sub
eric
Is it possible when specifying the file path for saving, to determine a part of this file path from a variable in a cell of your Excel spreadsheet?
Dim chemin As String
chemin = "C:\Users\Louis\Desktop\Louis Nadeau\Travail\Entreprises\Matrixcel\Clients\resiver\Diagnostiques\"
ActiveWorkbook.SaveAs Filename:=chemin & Worksheets("diagnostique").[c2] & [" "] & [c4].Value
Example: My clients are all in the same folder named "client"
client a
client b
client c
In my spreadsheet, I have a place where I write the client's name... I would like to be able to indicate from this cell the exact location to save the document...
e.g., C:\Users\Louis\Desktop\Louis\Travail\Entreprises\Matrixcel\Clients\ ???? \diagnostique\"
I have made attempts by naming a variable... but I am really not a programmer... so if you have 2 seconds to help me, it would be greatly appreciated.