How to save Visio macro as add-in - vba

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.

Related

Editing the ribbon of an existing Power Point Add-In (to fix display error)

I have been asked to remedy a display error of an already existing Power Point Add-In (error occurs when moving from Office 2007 to Office 365)
See picture below
I need to get rid of the parts highlighted by the red boxes.
Primary question: How do I open the add-in-file (I have the original .pptm file) so that I can edit how the ribbon is displayed?
My Background: I know VBA very well but have never done XML-development of the ribbon before.
A pptm file uses the Open Packaging conventions of the Office Open XML specification. Open the pptm with WinZip or 7-zip, or rename the .pptm to .zip, and browse the contents. You should find a file within the zip-file called something like CustomUI.xml or CustomUI14.xml, although the exact name can be anything, and will be specified in the .rels file in the root of the file (there can be 2 files, one for Office 2007 and later ribbons, and one for Office 2010 and later, in which case the 2007 version is ignored in 2010 and later).
Once you've found the file, extract a copy, make your edits in any text editor, and then copy the file back into the pptm, replacing the existing ribbon customization file.
Then load the pptm, and check your changes were successful.
PowerPoint add-ins don't show their code in the VBE, by default, although macro-enabled presentations do. If it is an add-in, you may need to tweak the registry in order for the add-in project to display. See this article for details: How To View Your PowerPoint Add-in VBA Code Inside The Visual Basic Editor

Word formatting macro that calls another macro on a networked drive

I already have .docm files that have simple formatting macros embedded in them. The macros work. However I have 100+ different .docm files that use basically the same macro. Instead of changing the macros on all 100+ .docm files when I need to change a format, I would like to place the macro in a separate text file in a stable location on a network drive and have the macro code in each .docm file reference that text file.
I tried a Call Shell(AppName,1) statement where the AppName contains the path of the txt file, but the compiler won't work with a colon.
I researched creating a macro to change other macros embedded within each document, but was advised against it due to virus scanners.
It's not possible to run a macro from a text file, the way you imagine. (Cool idea, but a security risk, I think.)
Better would be to bring all the macros together in a single template (dotm), which you put in your STARTUP folder. When Word loads, it will load this template (with all its Ribbon customizations and macros) as an "add-in". (See also the Developer/Add-ins dialog box, which is where these can be managed.)
In this way, your code can be managed centrally - but you do have to explicitly open the template in order to make changes to the code. It can't be done just over the loaded add-in (that's only possible with Normal.dotm).
You can also have macros in this add-in template that you call from other macros. This can be done using the Applicaton.Run method.

can we run/install macro in without macro enabled files (pptx)?

I wrote some macro of PowerPoint. Now if I want to run these macros, I need to save my PowerPoint as pptm file. It is kind of matter, as I need to save the final file as pptx not pptm. Is there any way, I can install or run my macro to pptx files? I mean could I install my macro as an add-in, and it is working in pptx file.
If the way works, I can save my macro template powerpoint as pptx,
that is easier and more convenient.
Thanks,
You could create an application add-in which would allow the Public procedures within it to be available independently of the PowerPoint file(s) you are working on in any given session. You could optionally add controls to a custom ribbon tab by editing the fluent UI XML of the file (I have some articles on Stack Exchange to show you how) and link those to your macros.
To create an add-in, save the .pptm file as a .ppam file (the folder location will change accordingly). Then in PowerPoint, assuming you have the Developer tab enabled, you can click Add-Ins and load your add-in from there. If the Developer tab isn't enabled, you need to go into the Backstage by clicking File then Options to add add-is.
To make sure the add-in loads automatically each time PowerPoint starts you can add code to the Auto_Open macro to add the two relevent registry keys (add-in Path and AutoLoad flag) or do this manually using regedit.exe. If you are deploying to many machines, the add-in can be wrapped in a setup.exe or setup.msi package but that is another topic.
No I don't think so there is anyway to run macro without enabling it.
But Alternate solution can be to.
Save the main file as .pptx and you can have another file as .pptm you just need to add sub to open the .pptx or main file and perform the macro fuctions from there
In this way your macros file and .pptx are seperate and you can achieve what you are trying to do via the .pptm files.
Hope this helps.

Store macro's in powerpoint

I've created some macro's for my powerpoint file. Problem now is that I can only use them for that particular powerpoint. Does anybody know how I can create a some kind of personal macro workbook in powerpoint / Word (like the one you have in excel)?
No such equivalent to the Excel Personal Macro workbook in PowerPoint.
Take a look at http://skp.mvps.org/ppafaq.htm. You need to save your pptm file as an add-in (ppam).
Once saved as an add-in, you need to load it via File > PowerPoint Options > Add-ins > Manage: Add-ins > Go (at the bottom). Then Browse.
Hope that helps.

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)