Rolling out Word Macros to various Users without affecting existing Macros? - vba

Am a complete newbie in Macros and do not find much support in Word macros
I have a macro with New ribbons which needs to be rolled out to various Users without affecting their current macros.
Which is the best possible way to perform the same.
Thanks in advance!!
P.S. Not sure if similar query has already been addressed. Didnt find any conclusive answer yet.

Your code and ribbons need to be in a template (.dotm) located in the startup folder.
On Windows the default location is \Users\<UserName>\AppData\Roaming\Microsoft\Word\STARTUP

Related

Identifying macros in a spreadsheet using LibreOffice Calc?

Is there a way to find out what macros are in a LibreOffice Calc file?
I went to the menu Tools > Macros > Organize Macros, and reviewed all the options, but I am not seeing anything that tells me what macros are in use. Isn't there some way to detect what they are and make changes if desired? It's a file created by someone else, and I have very basic knowledge of spreadsheets.
I could not find the answer in the Help files, which cover creating and organizing macros but do not give instructions on where to look just to see what macros are running in a file.
Thanks in advance for any help you can offer.
Not intended as an answer to the question, but this is what I was talking about in comment on main question.
(Why can't I post an image as a comment???)

How can I expose Word VBA macro code as text files in VSC to better commit and track code changes?

Background and Problem
I lead a team of tech writers. Our team has a Word template (.dotm file) that has a bunch of VBA macros we've created over the years to help us automate tasks in Word. The macros are obviously stored inside of a .dotm template. Given that the code is stored in a binary file, the code is not easily traceable across commits.
Currently, we have to pull the changes on the branch and then open the macro inside Word's embedded code editor from the .dotm. But there's no way to see what exact code changes someone else made line by line or resolve conflicts using something like Beyond Compare.
What I Need
I'd like to find a way to automatically expose the VBA code from the .dotm as some kind of text file so that we can:
Do Word VBA coding tasks within VSC
Easily track and review each others code changes at the line level using our git repository
Resolve merge conflicts more easily
Has anyone found a way to do this?
What I've tried
I've tried searching online and on stackoverflow.
Hoping it might help, I installed ScriptLab, and I after following the MS tutorial, I now have Office Add-Ons working with VSC.
(https://code.visualstudio.com/docs/other/office),
(https://learn.microsoft.com/en-us/office/dev/add-ins/tutorials/word-tutorial) While the Office Add-Ons through VSC does provide an alternate (more modern) way of automating using Javascript, and the .js files are commit-able, it's not providing a way to expose the Word VBA, at least not that I could see.
Thank you in advance!
ScriptLab add-on is for playing with JavaScript code instantly, not designed as a macro infrastructure in Office.
Sounds like you need to switch your VBA macros to COM add-ins rails. There is no converters that can do this part of work for you automatically.
You may consider creating a VB.NET based add-in. In that case you will avoid language translating issues. You may find the Converting Code from VBA to Visual Basic .NET article helpful. It presents issues to consider when converting your Microsoft Office solutions from Visual Basic for Applications (VBA) to Visual Basic .NET. Provides a general overview of their differences, and then uses examples from Word and Excel to describe how you can use Visual Studio Tools for the Microsoft Office System to convert your code.

How to move existing Outlook VBA code into an Outlook add-in?

I am trying to develop add-ins because my organization wants to move away from macros, due to the logistical tasks of deploying to thousands of users.
Is there a guide to repurpose existing VBA code into add-ins?
I want to be able to view/modify the source code.
Most helpful article so far:
https://blogs.msdn.microsoft.com/csharpfaq/2010/09/27/converting-a-vba-macro-to-c-4-0/ where they suggest "recording a macro in Office and then use the results in their code in VS".
I'm not aware of any VBA to VB.NET conversion tools, but the similarities are enough that you can copy and paste most code and correct the differences on the individual lines that prevent compilation. However it would be necessary to have a decent working knowledge of VB.NET in order to do this effectively.
I would though recommend that this task be considered a complete re-write, especially since you need to port it to an add-in project. The way you call your VBA methods may differ greatly depending on whether they are event or UI/Ribbon driven.
Also note that there is no macro recorder for Outlook.

Vba Project Guidance

I have a general question and I'm not sure where to begin, literally. Can you please leave any direction at a fairly high level so I have the chance to try to figure it out for myself? Here's my initial plan, but here's the issue! I don't know where to start. Where would I begin with this? Would it be an Excel module? I need some direction guys!! Let me give you a quick run down of what we're trying to accomplish.
We start out with 2-3 customer specific spreadsheets with an account number + [static] file name.xlsx and about 7 generic template excel files where we use the data from the customer specific spreadsheets and save a copy of each of the template files in the customers store folder.
What I'm trying to figure out if VBA is the direction that I need to be going with this or if there is another method that would accomplish the same goal or be more efficient at getting it done. My thinking at this point is open one of the customers files, save the active workbook file path as a string (this would contain the file directory, division, customer number and customer name), split the string of the file path and save the information that I need as variables, open the appropriate template files based on division number, probably run a couple recorded macros then re-save the files using the account number in the appropriate directory. If there's anything else I left out for this to make more sense, please let me know and I'll re-edit the post. Thank you in advance for any guidance!!
I don't think you should use Access or VSTO - I'll explain why, then offer a practical way forward.
Access is way over the top for what you want to do: most people find it much easier to write code in Excel VBA (I speak as a trainer with 20 years of experience, who is a guru on both packages).
Visual Studio Tools for Office was Microsoft's attempt to get the business world to stop using VBA in Excel, and use the much more robust VSTO within Visual Studio. It's a great idea, but unfortunately not many people seem to be adopting it. In computing it's rarely a good idea not to go with the flow (and anyway, the learning curve for VBA is shorter than that for VSTO, IMHO - hope that's enough acronyms in one sentence!).
As to the practical solution: I've just finished writing a fairly large online tutorial in Excel VBA, which is at exactly the level you need, I think.
Good luck!
Since you are dealing with XLSX files then you are in Office 2007 or 2010, so you could use Visual Studio Tools for Office. This will allow you to use the .Net framework and C# or VB.Net in Visual Studio to get a better development experience than VBA. You could add your own ribbon and buttons to Excel to help accomplish your tasks.

Is there any way to simplify Outlook macro installation?

I've created Outlook 2007 macro, which add additional item to mail context menu (Sub Application_ItemContextMenuDisplay). Now I would like to allow other users to use this macro. How can I simplify macro installation for them?
Now I have to ask them to run Macro editor and copy-paste the macro code.
Probably, I can convert that to some Outlook addin / msi?
There's no way to deliver VBA code in a "correct" way to other users. Microsoft itself recommends your approach (copy-paste), because that is the only way to preserve what other users have possibly inserted in their outlook code file (VBAProject.otm).
I propose that you do some studying for yourself before asking beginner questions. There are plenty of resources available which can be found easily. I recommend you to start with OutlookCode , where a very good choice of articles will led you to understand how to go on.