Can I base a word template on another template - vba

For the purposes of branding, our Word normal.dot template is updated via the login script. This pains me terribly, because I have a number of very useful VBA macros that I want to have access to. Specifically, I have two macros that I add to the Quick Access Toolbar in the title bar that I use all the time.
From what I understand, those macros can only be taken from the document itself or from the template it is based on.
What I am looking for, is a way to either:
Add a QAT button to a macro in another file somewhere.
Base all my documents on a new template (call it abnormal.dot) which in turn is based on normal.dot, so it can retain the macros even when normal.dot is overwritten.
Any other way of achieving my goal.
Any ideas?

You can add additional templates to your Word Application.
Go to Developer Tab on the Ribbon >> Templates section >> press Document Templates...
In new window on Template page you will find Add button on the right- add there some additional templates. This should help.

Related

Make a ribbon button reference the macro in a new workbook instance rather than in the source template

I have a macro-enabled Excel template which contains a ribbon button pointing to a macro sub. The button assignment still points to the source template, however, instead of the sub in the new document. If I create a document and then move or delete the template, I'm no longer able to use the button in the new document:
I've noticed that the ribbon button seems have the macro's source template path hard-coded, and there isn't any place I can find in ribbon customization UI to change it:
I'm certain this has been asked before, but I've tried a number of different ways of searching for it without coming up with anything.
I found this which talks about a button on a form, not a ribbon, and I found this which seems to be generating "shapes" programmatically and assigning their action; neither of these two are relevant.
This is the closest I've found, but whereas the QAT customization tab has the option for setting the target:
the ribbon customization tab does not have that. Any help would be greatly appreciated.

No Access to Template's Document

I have an existing Macro Enabled Template which I would like to add Content Control to, to be available on the screen when the Template is accessed.
I know how to add the Content to a Word Document and then save it as a Template. The problem is that I cannot view the Exisiting Template's Word Document due to the view Object being greyed out. See below:
I really do not want to copy all my Macros and my quick texts over to a new document just to add one line of text and a button.
I can easily add the required text and CommandButton by having a script run in a Document_New Sub under the ThisDocument. The problem is that this Sub bombs out due to Macros not being enabled. I intend to have the Template distributed to numerous colleagues, therefore having the Text and button on the document will avoid any confusion as to what to do with the template.
You need to open the Template via File - Open
Opening the Template this way will display give you access to the Template.
For info: The name of the Template will appear in the Center of the Word Application.

How to assign themes and Quickstyles in Word VBA

Where I work a department has created several theme files and quickstyle colours they want used in different circumstances.
I am wanting to create a macro that when run would save the theme automatically, and then assign a quickstyle colour group.
I have tried the macro recorder does not provide any hints as the macro is blank after attempting to record the actions, this is using either the mouse or keyboard. Searched everwhere and no solutions.
I can create the ribbon tab and buttons where we will call the macros from, I have already created macros and forms to populate documents with addresses etc.
But I cannot find any where I can set and save a theme or quick style and or colours.
A good idea for VBA is always to look into the Object Explorer in the IDE. Just press F2 while in the VBA Editor and type in the search field "theme".
There are the methods ActiveDocument.ApplyDocumentTheme(Filename as string) and ActiveDocument.ApplyTheme(Name as string). For quick styles you'll find also methods.
I don't have the time to test it, but I guess here you can go on.

Please let me know feasibility using Excel and VBA programming and suggest solution approach

We have following requirement to be done via excel and VBA programming. Please check and let me know if it feasible to do so and if not what way would be best to do it.
There would be excel spreadsheet say excel 2007/2010 with 2 tabs.
1st tab contains normal excel data
In 2nd tab user can enter a particular value and then click on a button in same tab. Is it possibly to have a button in excel tab and can it raise events like windows/web applications?
Now if button can be kept in excel and it can raise button click event then on such an event we need to create xml files. Is it possible to create xml files adhering to schema using excel &/or VBA programming
You need to activate the developer tab (from backstage go to Options and check the visibility of this tab) to get access to normal windows controls, like buttons and drop-down lists etc. You can easily place those in Excel sheets and write event handlers: the controls support the full range of events, including OnClick, OnMouseEnter etc...
You can write custom text files directly from VBA, but you can't validate those. The usual way to do so is just to concatenate small XML blocks into a bigger file, so XML output is more like a normal text output. But it works fine and as long as you do not need to perform something really complicated it is also ok.
EDIT: You can easily add references to custom COM objects (.dll or .ocx) and use them directly in your VBA code. One very helpful suggestion (see the comment below) is to use the MS XML library.
To add a reference just open the code editor (Alt + F11) and then go to Options -> References. Most of the references you need will be already in the list and you just have to check them, but you can also add your own custom libraries by clicking on Browse.

Editing Word 2003 template with custom toolbar in Word 2007

I only have Word 2007 and a Word 2003 template (.dot file).
When I open it, I can see it has macro's in it, stored in modules. I can also see that the template adds buttons to the add-ins tab in the ribbon.
How can I modify these buttons? Like the text or which macro each button triggers?
As a test I deleted all macros in the template, saved it, restared it, and it still gave me custom buttons in the Add-in tab. Of course if I press those buttons, it gives me error that the macro is not there. Which is fune. Then, if I view the template's code (Alt-F11), there is really no code at all. Also no Add-in is loaded (as seen in the Word options > Add ins window). So how does the Word 2003 template know which buttons to load? Where is the custom toolbar info stored in the Word 2003 template?
i am not sure i fully understood your question. Yet, here are a few elements.
Modify the buttons generated by a macro
You have to change the vba code. See :
this link for Word 2003 : http://www.ozgrid.com/VBA/custom-menus.htm
this link for Word 2007+ : http://www.rondebruin.nl/ribbon.htm
Buttons already loaded
If your custom buttons still appear after you deleted the code :
i'd think that you missed some part of the code to delete, can you re-check ? in every module of the doc
are you sure you didn't save a doc instead of saving the template ?
If these tips doesn't answer your question, please give us some more info on your problem or if possible, give us the template you are using.
Regards,
Max