PDA

View Full Version : Is it possible to transfer Macro Description text to another machine?



Duvdev
04-23-2014, 12:45 PM
Hello,

Does anyone know of a way to transfer macro descriptions to another computer without transferring through a .bas file? I believe the descriptions transfer through the .bas file but I need to transfer through a template instead. By descriptions I am referring to the “Description:” field labeled at the bottom of the Word 2010 > Macros (alt + f8) screen.

I was able to transfer the macros using a .dotm template file and placing it into the Microsoft Word templates directory. All of the macros can be viewed and fired with no problem. I simply cannot figure out how to also transfer the Description: text.

Thank you!

snb
04-23-2014, 02:24 PM
Sub M_snb()
For Each vc In Documents.Open(AddIns(1).Path & "\" & AddIns(1).Name).VBProject.VBComponents
If vc.Type = 1 Then
With ThisDocument.VBProject.VBComponents.Add(1)
.Name = cm.Name
.CodeModule.AddFromString vc.CodeModule.Lines(1, vc.CodeModule.CountOfLines)
End With
End If
Next
End Sub

instead of AddIns(1).Path & "\" & AddIns(1).Name you can use the fullname of the templace that contains the macros.