View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
kmdaly kmdaly is offline
external usenet poster
 
Posts: 3
Default Spreadsheet save using a macro

Okay, I got the macro to work for one part of the scenario. But could use
additional assistance. I am using a template that when saved should update an
Excel DB (spreadsheet defined using Template wizard) with new records, save
to a new worksheet (this part is working) and location; then clear the
template for the next entry. I can get the record update to work (write
record to DB) or I can get the macro to create a new worksheet and save it
but I can't seem to get them to work together. Any help is welcome
"kmdaly" wrote:



"Norman Jones" wrote:

Hi KM,

Try something like:

'===================
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim aCell As Range
Dim sPath As String

sPath = Application.DefaultFilePath '<<======== CHANGE
Set WB = ActiveWorkbook '<<======== CHANGE
Set SH = WB.Sheets("Sheet1") '<<======== CHANGE
Set aCell = SH.Range("Invoice_Number") '<<======== CHANGE

WB.SaveAs CStr(aCell.Value) & ".xls", FileFormat:=xlNormal

End Sub
'<<===================

---
Regards,
Norman



"kmdaly" wrote in message
...
I created a macro to save a spreadsheet from a template. I want to use the
cell "invoice number" as the name when doing the save. I have not been
able
to figure out how to tell the macro to use a specific cell for a name
save.