auto save activeworkbook for certain name

rohmadi02

New Member
Joined
Nov 3, 2011
Messages
3
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
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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
Can anyone help me on my below issue ??
Thanks

Code:
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
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top