Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2025, 01:04 PM
Italophile Italophile is offline macro to backup my VBA/macro text Windows 11 macro to backup my VBA/macro text Office 2021
Expert
 
Join Date: Mar 2022
Posts: 555
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Running either of the code examples here will generate an error:
Screenshot 2025-02-10 195119.png


unless you have given permission for VBA to access the code project

To grant permission:
  1. File | Options | Trust Center | Trust Center Settings

    Screenshot 2025-02-10 195903.png
  2. Check the option to Trust access to the VBA project object model
    Screenshot 2025-02-10 195740.png

NB: This is not generally considered a safe thing to do unless you really know what you are doing as it will also allow malware access.
Reply With Quote
  #2  
Old 02-10-2025, 01:43 PM
macropod's Avatar
macropod macropod is offline macro to backup my VBA/macro text Windows 10 macro to backup my VBA/macro text Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,469
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Italophile View Post
NB: This is not generally considered a safe thing to do unless you really know what you are doing as it will also allow malware access.
Absolutely! And, given that you'd really want to be granting access before running the macro then removing it immediately afterwards each time you want to do a backup, I fail to see what's gained over simply pressing Alt-F11 to open the VBE, then manually exporting the code & forms requiring backup.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-10-2025, 03:16 PM
Italophile Italophile is offline macro to backup my VBA/macro text Windows 11 macro to backup my VBA/macro text Office 2021
Expert
 
Join Date: Mar 2022
Posts: 555
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by macropod View Post
Absolutely! And, given that you'd really want to be granting access before running the macro then removing it immediately afterwards each time you want to do a backup, I fail to see what's gained over simply pressing Alt-F11 to open the VBE, then manually exporting the code & forms requiring backup.
Or, even better, prevent the issue from occurring in the first place by storing code in a template located in the user startup folder, instead of Normal.dotm.
Reply With Quote
Reply

Tags
backup/macros, vba save



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word macro to cut a range of text and apply to subsequent text as a hyperlink scientist101 Word VBA 9 07-20-2020 04:57 PM
Macro to add title in header is missing text once macro is run shawnee24 Excel Programming 1 05-27-2015 11:50 PM
Macro to add title in header is missing text once macro is run shawnee24 Word VBA 3 05-27-2015 12:35 PM
Microsoft Word macro to find text, select all text between brackets, and delete helal1990 Word VBA 4 02-05-2015 03:52 PM
Macro to find coloured text and replace with form-field/formtext containing that text tarktran Word VBA 1 11-26-2014 08:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft