J
John
Hi there,
I'm having a bit of trouble with a Save As file dialog. The problem is that
I'm creating a copy of a workbook and it's the new copy that I want to "save
as", but the original workbook is the one getting saved! Can anyone tell me
how to ensure that the copy gets saved and ond not the other way round?
Thanks in advance
John
Code as follows:
Public Sub SaveInvoice()
Dim FD As FileDialog
Dim wkbNewInvoice As Workbook
Dim wkbCurrent As Workbook
Set wkbCurrent = ThisWorkbook
Set wkbNewInvoice = Application.Workbooks.Add
wkbCurrent.Worksheets("Invoice").Copy Before:=wkbNewInvoice.Sheets(1)
Set FD = Application.FileDialog(msoFileDialogSaveAs)
With FD
'.Filters.Add "*.xls", 1
.InitialView = msoFileDialogViewDetails
.InitialFileName =
wkbCurrent.Worksheets("Variables").Range("InvoicesPath").Value
If .Show Then
.Execute
End If
End With
End Sub
I'm having a bit of trouble with a Save As file dialog. The problem is that
I'm creating a copy of a workbook and it's the new copy that I want to "save
as", but the original workbook is the one getting saved! Can anyone tell me
how to ensure that the copy gets saved and ond not the other way round?
Thanks in advance
John
Code as follows:
Public Sub SaveInvoice()
Dim FD As FileDialog
Dim wkbNewInvoice As Workbook
Dim wkbCurrent As Workbook
Set wkbCurrent = ThisWorkbook
Set wkbNewInvoice = Application.Workbooks.Add
wkbCurrent.Worksheets("Invoice").Copy Before:=wkbNewInvoice.Sheets(1)
Set FD = Application.FileDialog(msoFileDialogSaveAs)
With FD
'.Filters.Add "*.xls", 1
.InitialView = msoFileDialogViewDetails
.InitialFileName =
wkbCurrent.Worksheets("Variables").Range("InvoicesPath").Value
If .Show Then
.Execute
End If
End With
End Sub