Visio VBA Access to the macros sources - vba

I need to get Macros text from the Visio document using VBA. Is there any collection, property etc to access to the macros of the Visio document?

You can access the code in the VBA project for a document, assuming it's unlocked for viewing and the Visio installation security settings allows programmatic access to the VBA project.
If you have a document variable called Doc, it would be Doc.VBProject
If you enable the Microsoft Visual Basic for Applications Extensibility library in the references, you can dim a variable as VBProject and get intellisense to help you figure out how to get what you need.

Related

How to save Visio macro as add-in

I wrote a macro in Visio, but noticed that I cannot add it to the quick-access toolbar. I assigned it to a keyboard shortcut, and I'd like to make it available in any Visio file which is opened.
With Word I just saved my macros as word add-ins, and made them available as global templates, however in Visio the options only show COM add-ins.
How can I make my macro available in every Visio file opened?
You can't do this in Visio. A work-around is to save the macro into a stencil (you have to save the stencil in .vssm format) then if you always have this stencil open then the macro(s) will be available.

Customize ribbons for every MS Word document

I am new to development with VBA. I am working on a project based on MS Word macros.
Lately, I have been trying to create ribbons to access certain functionalities, but I have got limited success in it.
I want to customize ribbons using XML which should appear on all MS Word files and not the one I have used to customize ribbon.
Is there any way to create any XML file that can be utilised by all MS word documents without having to customize each one of them.
Thanks..
Regards
The answer for this is essentially the same as for making macros available to all documents:
Store the Ribbon in a template (together with the macros, so a dotm) and load it as an Add-in.
If it should load automatically, that means placing it in Word's STARTUP folder.

How to Make a VBA Excel Program Work on Other Excel Documents?

I'm very new with VBA Excel and i only know the things as far as i need for this report formatting task. My code is almost completed, but what i wonder is, how can i make my program work on several documents?
I mean, i want to choose an excel file via my program, then i want to start the process of report formatting. Then maybe user need to format another document, i want my program to be able to format that document too. how can i achieve that?
Thanks in Advance
Timur
The way I am currently doing this is by creating an Excel add-in. To do this, place your macros and forms into a new, empty Excel workbook and save as a .xlam document.
To use the macros, open the your Excel file and the add-in. To open the add-in automatically, save it to "C:\Program Files\Microsoft Office\Office12\XLSTART" (Vista).
You can even create a custom ribbon for your add-in using the Custom UI Editor for Microsoft Office http://msdn.microsoft.com/en-us/library/office/ee691832(v=office.14).aspx (The download link is at the end of the instructions)

Excel 2010 equation editor object access through vba

In Excel 2010 the equation editor is not listed in the Object Browser. In Word, the object is called OMath http://msdn.microsoft.com/en-us/library/bb256563%28office.12%29.aspx. Maybe Excel uses a Word object to display equations?
So the questions are:
Is there any way to access that object in Excel if said object is not in the object browser?
Specifically about the equation editor, is there any way to access it from vba in excel?
Thanks!
In Excel 2007, when you want to insert an equation, you have to insert an Object > Microsoft Excel Equation Editor 3.0. See on MSDN on how to use this.
You can add a new Equation with:
ActiveSheet.OLEObjects.Add(ClassType:="Equation.3", Link:=False, DisplayAsIcon:=False)
You can access these objects within the OLEObjects collection:
ActiveSheet.OLEObjects.Item(1)
It seems like Microsoft doesn't handle equations in the same way between Excel and Word (2007 at least) because Excel doesn't use the OMath object.

How to add a Word add-in 2007 to a particular word 2007 document

I have created a Word add-in which would load data in custom ribbon from external web service. I need to have that add-in in a document so that It can populate the data only on that document. I don't want to have application level add-in because It will try to load data for any other word document user might create. I want to do this as this document would serve as a template for other documents. Is this possible?
If the above is not possible, how do you actually install the word-2007 add-in. I see this link. Is this the way one should do it?
I am using VS 2010 Premium edition on Windows 7. I also have Word 2007installed in my machine.
You can use Visual Studio to create a document- or template- level addin.