Saving as a macro enabled excel file

jsbean17

New Member
Joined
Dec 27, 2018
Messages
1
I am setting up a department file that requires macros to be enabled. I have the code working to the point of opening the save as dialog box, but I am unsure as to how I can force the file type to default to macro enabled. Hopefully someone can help this beginner figure this out.

Code:
 'This ensures daily manpower is filled out



NonProdData:
    
    If Range("M12").Value = "" Or _
       Range("M13").Value = "" Or _
       Range("M14").Value = "" _
    Then
       Dim answer As Integer
         answer = MsgBox("Have You Filled Out Your Shifts Daily Manpower?", vbYesNo + vbQuestion, "Daily Manpower")
         
    If answer = vbYes Then
        With Application.FileDialog(msoFileDialogSaveAs)
        .AllowMultiSelect = False
        .InitialFileName = "https://mfg.spt.ford.com/sites/mapfm/Shift Communications/January 2019/"
        If .Show = -1 Then .Execute
    End With
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
you cannot. Each PC has its own settings to prevent malicious code from doing what you are trying to do.
Each person must enable macros on their PC.
 
Upvote 0
The standard workaround is
- add another sheet (SheetX)
- hide all original sheets (as VeryHidden) whenever workbook is saved
- unhiding VeryHidden sheets can only be done by VBA
- included a button on SheetX allowing user to unhide sheets
- button only works if macros are enabled
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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