Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-26-2024, 08:38 AM
IndianaITGuy IndianaITGuy is offline Keeping Macros/VBA with document Windows 11 Keeping Macros/VBA with document Office 2019
Novice
Keeping Macros/VBA with document
 
Join Date: Mar 2024
Location: Martinsville, IN
Posts: 25
IndianaITGuy is on a distinguished road
Default Keeping Macros/VBA with document

I had an interesting surprise when I got home and pulled up my network stored .docx document over the company VPN to find that all my VBA code was inaccessible! How can I bind all my VBA code for this project to this one particular document? When I complete my code and I assign to, say a button and then deliver it to a co-worker, how to I ensure every bit if intended code runs on the delivered document? As I mentioned above, this document is stored on our network an I need anyone on the network who pulls it up to be able to run the code intended for it?
  #2  
Old 03-26-2024, 09:19 AM
Italophile Italophile is online now Keeping Macros/VBA with document Windows 11 Keeping Macros/VBA with document Office 2021
Expert
 
Join Date: Mar 2022
Posts: 338
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Simply put the code modules into the document instead of Normal.
  #3  
Old 03-26-2024, 12:54 PM
IndianaITGuy IndianaITGuy is offline Keeping Macros/VBA with document Windows 11 Keeping Macros/VBA with document Office 2019
Novice
Keeping Macros/VBA with document
 
Join Date: Mar 2024
Location: Martinsville, IN
Posts: 25
IndianaITGuy is on a distinguished road
Default

Yeah I came to that solution a few minutes ago as my VBA memory comes back. I even see how/where to do it. Thanks.
  #4  
Old 03-27-2024, 06:25 AM
macropod's Avatar
macropod macropod is offline Keeping Macros/VBA with document Windows 10 Keeping Macros/VBA with document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

FWIW docx files cannot contain macro code. To include macros in such a document, it must be saved in the docm format and have the relevant code added to it - not just to its template.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #5  
Old 03-27-2024, 06:27 AM
IndianaITGuy IndianaITGuy is offline Keeping Macros/VBA with document Windows 11 Keeping Macros/VBA with document Office 2019
Novice
Keeping Macros/VBA with document
 
Join Date: Mar 2024
Location: Martinsville, IN
Posts: 25
IndianaITGuy is on a distinguished road
Default

Yes, I know that. I was neglectful in my use of the wrong file extension. Thanks.
  #6  
Old 03-31-2024, 03:07 PM
TessaMurillo TessaMurillo is offline Keeping Macros/VBA with document Windows Vista Keeping Macros/VBA with document Office 2010
Advanced Beginner
 
Join Date: Mar 2024
Posts: 33
TessaMurillo has a little shameless behaviour in the past
Default

Hi You need to open a document in which you want to embed VBA code. In Microsoft Word, go to the "Developer" tab and click on the "Edit Code" button. Write or paste your code into the VBA editor window. After writing the code, save the document in .docm format (a document with macros enabled).
  #7  
Old 04-06-2024, 02:34 PM
macropod's Avatar
macropod macropod is offline Keeping Macros/VBA with document Windows 10 Keeping Macros/VBA with document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

TessaMurillo: I have noticed quite a few posts by you that are either not at all relevant to the topic under discussion (e.g. posting Excel formula-based solutions to Word questions) or, like the one above, being little more than parroting what has already been discussed, including in threads already marked as solved (like this one).

Kindly keep your posts on-topic and substantive, otherwise you might find your posting privileges restricted.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging different documents in one big document keeping the chapters, figure numbers and tables village Word 8 06-06-2016 04:16 AM
Keeping Macros/VBA with document Word document with Macros with trusted locatin versus Word document 1997-2003 Cardinal2 Word 1 11-30-2015 07:42 PM
Keeping Macros/VBA with document Merging Word documents and keeping the formatting exactly as it appears in the original document NovaScotia Word 4 01-21-2015 11:44 PM
Keeping Macros/VBA with document Keeping exact layout of source document when I copy and paste mjbowen147 Word 1 11-17-2013 02:08 PM
arabic word document to notepad WHILE KEEPING ENCODING! wildheart25c Word 8 03-14-2012 07:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:31 AM.


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