Is it possible?

cstimart

Well-known Member
Joined
Feb 25, 2010
Messages
1,180
I highly doubt that it is possible, but hopefully I can get a definitive answer here. (Excel 2007)

I have a macro that I have created in a file that has a pivot table w/an ODBC connection. This is used by several people in my office and some of these people are paranoid about macro code being corrupt, malicious, etc... :rolleyes:

I could just move the code into my personal.xlsb file and the macro would work fine. However, I have built into this macro/file a flag that will not allow the file to be saved after the macro has run (to protect the common pivot table format).

I assume there is no way to incorporate that into my personal file, so I can save the shared file in a .xlsx format?

Thanks for the help!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Can't you just comment out the code that won't allow the file to be saved after the macro has been run? And then uncomment it after you've moved the file/macro?
 
Upvote 0
Not sure you understood my question.

Basically, this macro has been in the file for a while and noby knew about it except me, as it was an .xls (Office 2003) format. However, now that we've converted to Office 2007, the .xlsm makes people freak out.

My intent is to retain the macro, but utilize it from my personal file. However, the code to prevent the saving does not live in a Module, it's in the ThisWorkbook tab.

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Saved = (MacroRunFlag = True)
End Sub
 
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If MacroRunFlag = True Then
    MsgBox "File will not save after running the Macro."
    Cancel = MacroRunFlag
    Saved = True
End If
End Sub

MacroRunFlag in a Public/Boolean variable.
 
Upvote 0
.. this macro has been in the file for a while and noby knew about it except me, as it was an .xls (Office 2003) format.
Didn't the other users get a prompt about enabling macros when they opened the Excel 2003 file?
 
Upvote 0
That would seem to mean that in Excel 2003 their macro security setting was either ..

a) Very High. Which means the macro would have been disabled anyway and you can replicate that in 2007 with 'Disable all macros without notification'

or

b) Low. This can be replicated in 2007 with 'Enable all macros'
 
Upvote 0
That would seem to mean that in Excel 2003 their macro security setting was either ..

a) Very High. Which means the macro would have been disabled anyway and you can replicate that in 2007 with 'Disable all macros without notification'

or

b) Low. This can be replicated in 2007 with 'Enable all macros'

The IS Department has changed the setup in regards to the macros...either way, the .xlsm format does give away the presence of the macro and that causes the freak out.

Ideally, I would like to have the shared file in the .xlsx format.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,183
Members
452,893
Latest member
denay

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