AndresHernando
asked on
Excel VBA - Save a workbook as macro enabled
How can I save a workbook as macro-enabled?
Here's my vba code that I tried (save with extension "xlsm") but doesn't work... still tries to save as non-macro enabled.
Here's my vba code that I tried (save with extension "xlsm") but doesn't work... still tries to save as non-macro enabled.
Sub M_SaveAsMacroEnabled()
Dim v_TempFilePath as String
Dim v_TempFileName as String
Dim v_FileExtStr as String
Dim v_TimeStamp as String
Dim v_ReqName as String
v_ReqName = [RangeReqName].value
v_Location = [RangeLocation].value
v_DateYYMMDD = [RangeDateYYMMDD].value
v_TimeStamp = [RangeTimeStamp].value
v_TempFilePath = ActiveWorkbook.Path & "\"
v_FileExtStr = ".xlsm" '//Save as macro-enabled workbook
v_TimeStamp = Format(Now, "yymmddhhmm")
v_TempFileName = "FirstPartOfMyFilename - " _
& v_ReqName & " - " _ '//Next Part of the filename
& v_Location & " - " _ '//Yet another part
& v_DateYYMMDD & " - " _ '//And another
& v_TimeStamp '//Last part before extension
'//Save new file//
With ActiveWorkbook
.SaveAs ThisWorkbook.Path & "\" & TempFileName & _
v_FileExtStr
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Andres,
Pleased it solved the problem.
Thanks for the grade.
Patrick
Pleased it solved the problem.
Thanks for the grade.
Patrick
ASKER
Thanks! --Andres