ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save file as filename plus fieldname (https://www.excelbanter.com/excel-programming/348413-save-file-filename-plus-fieldname.html)

annep[_2_]

Save file as filename plus fieldname
 

I wrote this complicated spreadsheet with macros with 5 sheets. I am not
good at macro writing, but the wizard helps. On open I unprotect the
fields the user has to fill in. The user manages periodically to mess
up my formulas, because he keeps saving my original file with data. I
don't know how he does it, but he does.

The spreadsheet is called Joist
I now searched and found that I can password protect the spreadsheet
and make it open in read only mode. It works fine, the user can still
enter data upon trying to save the spreadsheet excel prompts for file
name as: copy of_Joist.

Is it possible to write some code to make the filename a cell from the
spreadsheet, in this case Input!C2 has the pour number, for example
2458, I would like to save the spreadsheet as Joist2458.


--
annep
------------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=494480


Mort_Komabt[_2_]

Save file as filename plus fieldname
 
Hi there,
You could try this code

Sub Macro1()

Dim fileext As String
Range("C2").Select
fileext = ActiveCell

ActiveWorkbook.SaveAs Filename:= _
"C:\Joist" & fileext & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub

"annep" wrote:


I wrote this complicated spreadsheet with macros with 5 sheets. I am not
good at macro writing, but the wizard helps. On open I unprotect the
fields the user has to fill in. The user manages periodically to mess
up my formulas, because he keeps saving my original file with data. I
don't know how he does it, but he does.

The spreadsheet is called Joist
I now searched and found that I can password protect the spreadsheet
and make it open in read only mode. It works fine, the user can still
enter data upon trying to save the spreadsheet excel prompts for file
name as: copy of_Joist.

Is it possible to write some code to make the filename a cell from the
spreadsheet, in this case Input!C2 has the pour number, for example
2458, I would like to save the spreadsheet as Joist2458.


--
annep
------------------------------------------------------------------------
annep's Profile: http://www.excelforum.com/member.php...o&userid=18851
View this thread: http://www.excelforum.com/showthread...hreadid=494480




All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com