Hello daglugub37,
Sorry I wasn't able to get back more quickly, the last couple days have been pretty long. Here is some code to help get you started.
Since it sounds like you have already written your macros, here is how you automate the process. Since you said you aren't real comfortable with VBA, this is step by step.
A. From standard Outlook, Click Tools, Macro, Visual Basic Editor (or Alt+F11).
B. How the editor appears can vary depending on various settings and user actions, so to ensure the proper pieces are visible, Click on View, Project Explorer (or Ctrl+R). The Project Explorer displays similarly to the folders in the File Browser, click a + sign to open it up. Click on any + signs you see so everything is available to you.
C. To add your macro code to Outlook so it will load automatically for you, Right click on ThisOutlookSession and select View Code or DoubleClick it. This will open up the code editor.
D. At the top you will see 2 drop down comboboxes. The one on the left will probably say (General) and the one on the right will say (Declarations). Click the drop down arrow on the left combobox and select Application. The combobox on the right will change to display all of the events available to you. If it created a little bit of code for you, don't worry about it for now.
E. Click the drop down arrow on the right combobox and select Startup. It will create a sub routine declaration for you as follows (Note: I added 'Put your code here).
Code:
Private Sub Application_Startup()
'Put your code here
End Sub
F. Place your macro code as noted above and it will be executed every time Outlook starts.
G. You can now go back and delete any similar code it created for you that you don't need.
I hope this helps. Please feel free to post again if you have more questions.
If you want to or need to add some custom buttons to your toolbars here is an example showing you how to do that. Click Insert, Module on the Insert menu and copy the following code into it. You can single step through the code by clicking anywhere in the code and then pressing F8 repeatedly. F5 will run it all the way through.
A. This code will loop through the highest level of command bars and show their names if they are visible. This list corresponds to checked items you see if you click View, Toolbars on your menu.
Code:
Sub TestIt()
Dim obj As Object
For Each obj In Application.CommandBars
If obj.Visible Then
MsgBox obj.Name & " " & obj.Visible & " " & obj.RowIndex
'lists in immediate window
Debug.Print obj.Name & " " & obj.Visible & " " & obj.RowIndex
End If
Next obj
Set obj = Nothing
End Sub
To see the Immediate Window, while in the VB Editor click View, Immediate Window (Ctrl+G)
B. Use the results from A above if you want to display your custom toolbar on the same line as an existing one. For purposes of discussion, let's say you wanted to display it on the same line as the formatting toolbar if it is visible. The temporary options tell the system to delete the toolbars when you close Outlook. They are recreated every time.
Code:
SubTestIt2()
Dim lngRowIndex As Long
On Error Resume Next
With Application
If .CommandBars("Formatting").Visible Then
lngRowIndex = .CommandBars("Formatting").RowIndex
Else
lngRowIndex = .CommandBars.Count + 1
End If
End With
'Next 3 lines add an empty custom ToolBar and make it visible
With CommandBars.Add("YourCustomName", msoBarTop, False, Temporary:=True)
.RowIndex = lngRowIndex
.Visible = True
'This code adds a CommandBar Button
With .Controls.Add(msoControlButton, Temporary:=True)
.DescriptionText = "Inserts a new payroll row for the active worksheet"
.Style = msoButtonCaption
.Caption = "&New Payroll"
.TooltipText = "Insert a new payroll line in current worksheet"
.OnAction = "YourCustomAction"
End With
End With
On Error GoTo 0
End Sub
Code:
'Private sub routine which corresponds to OnAction above
'This code is executed when CommandBar Control added above is clicked
Private Sub YourCustomAction()
MsgBox "YourCustomAction"
End Sub
Have a great day!
j2consulting@yahoo.com