Export a Outlook form written in VBA - vba

I recently wrote a form in VBA for Outlook and saved it to my personal form folder.
Now this form should get exported in a userfriendly fashion. What is the best practise here?
I know that you can go to File -> Export file... in VBA, but this seems to have caused some problems in the past and doesn't seem very intuitive to use both the frm and the frx files.
The form is supposed to be accessed by employees to book their holiday.

That is COM add-ins were invented for. They are designed to be installed on multiple machines and users. VBA macros are not designed for transferring the code - the infrastructure doesn't provide anything for moving solutions automatically like you could do in case of COM add-ins. You need have do that manually in VBA.
If you consider moving your solution to the add-in rails, see Walkthrough: Create your first VSTO Add-in for Outlook to get started quickly. You may choose VB.NET which has a similar syntax with VBA.

Related

How to save a word macro as an add-in

Trying to save a MS Word macro as an add-in, fully independent, portable and installable as a word tool. What kind of literature should I consult to learn this technique?
So far I've tried looking on Google and StackOverflow. Many people ask similar questions, no one seems to provide a valid answer.
In the end, I would like to be able to export a macro in the form of a exe/batch/whatever to be summoned/installed from word and customize the tools ribbon permanently, to conceal the macro sourcecode and easily propagate to other machines.
It's not possible to use VBA macros as exe or batch files. It is possible, however, to load a macro-enabled template as an add-in. All the functionality will then be available (Ribbon, keyboard shortcuts, macros, building blocks).
Save the document as a dotm file (template, macro-enabled)
Copy the file in the STARTUP folder. Word will then load it automatically.
For a "real" add-in that uses the same COM object model as VBA it's necessary to build software based on the IDTExtensibility2 interface. There are number of tools that use this, making things easier. Microsoft's VSTO (Visual Studio Tools for Office) is one that costs nothing.
Another alternative is to use the newer Java Script APIs for Office. These are, in the case of Word, incomplete as far as functionality for the object model is concerned (can't do everything the COM object model is capable of).

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.

updating userform in outlook using vba

I have written some vba (userforms mostly) to help my colleges with various task in Outlook, every time I write some extra code I have go to twenty desk to perform a manual update because outlook can't access the vba model.
VBA Extensibility in Outlook
is there a way to automate this update? using sendkeys was suggested but this is not actualy an update, you would still have to delete the old file manualy. Some of my colleges can't handle that. :-(
Multi-user solutions should really be designed as a COM Add-in. VBA macros in Outlook were never intended to be deployed and are meant for personal use only. However, there are some deployment methods available - see here, but use at your own risk: http://www.outlookcode.com/article.aspx?id=28

To separate code and document in Office automation

I'm currently working on an vba project to help document developers do their work better and faster.
The tool is helpful during the developing, but however, it's no longer needed after the document is complete.
So, is there any ideas, about how to export a pure document without vba code automatically? Or shall I do this stupidly by opening vba and remove all of its code?
Further more, Is there any ways, to automatically apply vba code to an existing document?
You can create an add-in. Your VBA code lives in the add-in, but operates on your documents. The add-in can create a custom menu to run your various routines.

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.