Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Carlton Martinez   on Aug 28 In MS Office Category.

  
Question Answered By: Fjodor Bonkob   on Aug 28

Sure....this is way one:

************************
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim weekending As Date, weektext As String
Dim filename  As String


weekending = Sheets("Corporate").Range("g5").Value2
weektext = Replace(weekending, "/", "")

filename = Application.GetSaveAsFilename("C:\Reports\Marketing\Top 50\top 50
w-class 1 " & weektext & ".xls")

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs filename, xlNormal

Application.DisplayAlerts = True

End Sub

This is way two - using the event  to call a sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

End Sub


and this is the sub in a module:


Private Sub saveit()
Dim weekending As Date, weektext As String
Dim filename As String


weekending = Sheets("Corporate").Range("g5").Value2
weektext = Replace(weekending, "/", "")

filename = Application.GetSaveAsFilename("C:\Reports\Marketing\Top 50\top 50
w-class 1 " & weektext & ".xls")

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs filename, xlNormal

Application.DisplayAlerts = True

End Sub

Any ideas? I'm pulling my hair out on this one.

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Before Save event problems Or get search suggestion and latest updates.


Tagged: