Hello everyone,
I'm going to complete my simple application relating to creating new workbook, copying data sets from the workbook where I run my macro, pasting the set to the new one with possibility to point out a path.
When I try to save my new workbook in my own selected path, I get the error:
"object doesn't support property or method vba"
What is wrong with the line:
"wrkBk = Application.GetSaveAsFilename(InitialFileName:=ThisWorkbook.ActiveSheet.Name, FileFilter:="Excel Files (*.xlsx), *.xlsx")"?
Thank You in advance for any suggestions.
I'm going to complete my simple application relating to creating new workbook, copying data sets from the workbook where I run my macro, pasting the set to the new one with possibility to point out a path.
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim ans As String
Dim wrkBk As Workbook
ans = InputBox("Do You want to create raport? ")
If ans = "Yes" Or ans = "yes" Then
Set wrkBk = Workbooks.Add
ThisWorkbook.ActiveSheet.Copy wrkBk.Sheets("Sheet1")
wrkBk = Application.GetSaveAsFilename(InitialFileName:=ThisWorkbook.ActiveSheet.Name, FileFilter:="Excel Files (*.xlsx), *.xlsx")
wrkBk.Save
End If
End Sub
When I try to save my new workbook in my own selected path, I get the error:
"object doesn't support property or method vba"
What is wrong with the line:
"wrkBk = Application.GetSaveAsFilename(InitialFileName:=ThisWorkbook.ActiveSheet.Name, FileFilter:="Excel Files (*.xlsx), *.xlsx")"?
Thank You in advance for any suggestions.