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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel auto saving & applying syntax

Status
Not open for further replies.

Nik1979

MIS
Sep 1, 2003
3
GB
This was my original message:-

Hi, I’ve setup a invoice document within excel. I was wondering if there was ways to get excel to automatically save the document with a new file name that corresponds to the invoice number. At the moment the files are being saved manually using the save as function. However sometimes people forget to do this and save over the top of the last invoice.

This was the response:-

Try posting in Forum707 or Forum68

In VBA, the syntax

ActiveWorkbook.Close True, "Invoice" & range("A1")

will save the document at current path with the name "Invoice" and whatever resides in cell A1

Roy-Vidar

I’m a complete beginner and don’t understand what is the “VBA” and how to apply the syntax.

Nik.
 
Hi,

You want to use the SaveAs method.

Construct a string with the path & file name WITH ".xls".

Might look something like this...
Code:
Application.Displayalerts = False
With Activeworkbook
  sFName = .Path & "\Invoice" & [A1] & ".xls"
  .SaveAs sFName
End With
Hope this helps ;-)

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top