Hello Experts..
I need your help to point me to the right direction.
I have an Excel macro that extract data directly from SAP system , and when the data export it to Excel it's has workbook name as ALVXXL01(1).
Usually I use ActiveWorkbook.SaveCopyAs code to grab it and save it to desired folder and file name but sometimes it's won't work . it's saved the master file instead of the activeworkbook of ALVXXL01(1).
Now , I am trying to use below code but it's still not works yet.
Sub SavecopyAsWorkbook()
Dim Wk As Workbook
Set Wk = ActiveWorkbook
Dim sWbk As String
Application.DisplayAlerts = False
If InStr(sWbk, "ALVX") <> 0 Then
Wk.SaveCopyAs Filename:="C:\Temp\testwbksave.xls"
End If
Application.ScreenUpdating = True
End Sub
Any help would be really appreciated! Thanks.
Regards,
Agung
I need your help to point me to the right direction.
I have an Excel macro that extract data directly from SAP system , and when the data export it to Excel it's has workbook name as ALVXXL01(1).
Usually I use ActiveWorkbook.SaveCopyAs code to grab it and save it to desired folder and file name but sometimes it's won't work . it's saved the master file instead of the activeworkbook of ALVXXL01(1).
Now , I am trying to use below code but it's still not works yet.
Sub SavecopyAsWorkbook()
Dim Wk As Workbook
Set Wk = ActiveWorkbook
Dim sWbk As String
Application.DisplayAlerts = False
If InStr(sWbk, "ALVX") <> 0 Then
Wk.SaveCopyAs Filename:="C:\Temp\testwbksave.xls"
End If
Application.ScreenUpdating = True
End Sub
Any help would be really appreciated! Thanks.
Regards,
Agung