Hi,
I have a code that works just fine, except for one big flaw: I am trying to save a file, but it doesnt "execute" the save. In other words, the everything is fine before the "save as" -dialog box and after it. But it doesnt save.
Could someone help me with this?
Sub ExportABC()
Dim xWs As Worksheet
Dim Rng As Range
Dim varResult As Variant
Set Rng1 = Worksheets("ABC").Range("ABC")
Set Rng = Range("ABC")
Application.Sheets.Add
Set xWs = Application.ActiveSheet
Rng.Copy Destination:=xWs.Range("A2")
Rng1.Copy Destination:=xWs.Range("A1")
ActiveSheet.Copy
varResult = Application.GetSaveAsFilename(, _
FileFilter:="Excel Files (*.xlsx), *.xlsx")
If varResult <> False Then
Application.DisplayAlerts = False
ActiveWorkbook.Close
ActiveSheet.Delete
Application.DisplayAlerts = True
Worksheets("ABC").Activate
MsgBox "Text"
Else
Application.DisplayAlerts = False
ActiveWorkbook.Close
ActiveSheet.Delete
Application.DisplayAlerts = True
Worksheets("ABC").Activate
MsgBox "Text"
End If
End Sub
Thank you!
Bookmarks