Results 1 to 18 of 18

Thread: [RESOLVED] How to record a macro in outlook2003?

  1. #1

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Resolved [RESOLVED] How to record a macro in outlook2003?

    Hello Everybody,
    Is there a way to record a macro in outlook (lets say 2003)?
    like you can do i excel...

    Thank you all in advance,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to record a macro in outlook2003?

    Quote Originally Posted by eranfox
    Is there a way to record a macro in outlook (lets say 2003)?
    No, you can not record a macro in Outlook.

    You can write macros in Outlook by going to the Tools menu, point to Macro, and then click Macros.
    In the Macro name box, type a name for your macro, and then click Create. The Microsoft Visual Basic Editor opens.
    Type or paste your code into the code window of the module.

    But, as I said, you cannot record a macro in Outlook.

  3. #3

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Quote Originally Posted by Hack
    No, you can not record a macro in Outlook.
    Hello Hack,
    I know how to write macros in outlook - well i started to do that only today...
    but i was looking for the record new macro line and didnt find it - you just answered my question.

    I wonder why you cant record a macro in outlook like you do in excel...

    Thank you for your reply,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to record a macro in outlook2003?

    Quote Originally Posted by eranfox
    Hello Hack,
    I know how to write macros in outlook - well i started to do that only today...
    but i was looking for the record new macro line and didnt find it - you just answered my question.

    I wonder why you cant record a macro in outlook like you do in excel...

    Thank you for your reply,
    ERAN
    For reasons known only to Microsoft, the VBA capabilities of Outlook (all versions) has been well below the VBA capabilities of all of the other Office products.

    It does make you just sit back and shake your head!

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Ooooh nooo, tell me you didnt diss on Outlook!

    Outlook can be considered to have more advanced VBA support then all other Office suite app with only Excel as a close competitor. Maybe Outlook doesnt allow you to record a macro because of security reasons and spam, virus', etc. The Forms support alone is far far better then any Office VBA Forms capabilities combined. I could go on and on but anyways...

    Is there something in particular you need to do that you needed to record a macro?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Quote Originally Posted by RobDog888

    ...
    Is there something in particular you need to do that you needed to record a macro?
    Hello RobDog888,
    Nothing special...just wanted to know if i can programmaticaly create a button .
    i know how to do it semi automatic:
    1)create the code for the button
    2)Choose View | Toolbars | Customize.
    In the Customize dialog, go to the Commands tab.
    Under Categories, select Macros.
    Drag the Project1.myMacro macro command to the desired toolbar.
    Right-click on the new Project1.myMacro toolbar button, then change the Name or button appearance as desired.
    Close the Customize dialog.

    is there a way to do number 2 programmaticaly?

    Thank you in advance,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Yup. Do you want a toolbar button or menu item?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Quote Originally Posted by RobDog888
    Yup. Do you want a toolbar button or menu item?
    Well if thats the case...
    i want to be greedy,can you show me the two possibilities?
    Thank you RobDog888 in advance,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Sorry for the delay but I have been too busy multi-tasking. I will work up a toolbar example too.
    VB Code:
    1. Option Explicit
    2. 'Behind ThisOutlookSession
    3. Public WithEvents oMnuSaveAs As Office.CommandBarButton
    4.  
    5. Private Sub SyncMnuSaveAsButton(btn As Office.CommandBarButton)
    6.     Set oMnuSaveAs = btn
    7.     If btn Is Nothing Then
    8.         MsgBox "Sync. of '" & btn.Caption & "' button event failed!", vbCritical + vbOKOnly
    9.     End If
    10. End Sub
    11.  
    12. Private Sub Application_MAPILogonComplete()
    13.    
    14.     Dim oCBmnuTools As Office.CommandBarPopup
    15.     Dim oCBmnuSaveMe As Office.CommandBarButton
    16.    
    17.     '<ADD A MENU ITEM>
    18.     Set oCBmnuTools = Application.ActiveExplorer.CommandBars("Menu Bar").Controls("&Tools")
    19.     Set oCBmnuSaveMe = Application.ActiveExplorer.CommandBars("Menu Bar").FindControl(msoControlButton, 1, "888", True, True)
    20.     If TypeName(oCBmnuSaveMe) = "Nothing" Then
    21.         Set oCBmnuSaveMe = oCBmnuTools.Controls.Add(msoControlButton, 1, "888", , True)
    22.     End If
    23.     With oCBmnuSaveMe
    24.         .BeginGroup = True
    25.         .Caption = "Save Email As..."
    26.         .Enabled = True
    27.         .Style = msoControlCustom
    28.         .Tag = "888"
    29.         .Visible = True
    30.     End With
    31.     Call SyncMnuSaveAsButton(oCBmnuSaveMe)
    32.     '</ADD A MENU ITEM>
    33. End Sub
    34.  
    35. Private Sub oMnuSaveAs_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    36.     MsgBox "oMnuSaveAs_Click"
    37. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Hello RobDog888 thank you for your reply!!!
    I just want to know where exactly to place this code and how to save it.
    do i save it as a dll or somthing like that.
    i new to this outlook programming so sorry for asking maybe stupid questions...

    Thanx again,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Ok, no prob. For this example you need to open Outlook and press Alt + F11 to open the VBA IDE. Then inside "ThisOutlookSession" you can paste all the code. Save the class and close Outlook. Re-open it and click the tools menu > Save Email As... and you will get your event to fire. In this example its a msgbox.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Hello RobDog888,
    There is somthing i still dont understand:
    where is the tools menu with the option of save email as?
    i did everything you said,but i cant find this tools menu...what is wrong?

    Thank you again,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Did you close and log off of Outlook and then restart it enabling macros?
    Attached Images Attached Images  
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Hello RobDog888,
    Well, in my tools menu i have everything except speech and save email as ...
    I went to View->ToolBars and searched for these two but nothing...
    What is wrong with my outlook version (2003(11.5608.5606))?

    Thank you in advance,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Did you paste the code into "ThisOutlookSession" class, enable macros, and restart Outlook?
    Also, it looks like you dont have Service Pack 1 for Outlook/Office installed. You may want to eventually do an Office Update.

    Edit: Make sure you have the reference to MS Office 11.0 Object Library. And you did say your running 2003?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Re: How to record a macro in outlook2003?

    Hello ,
    Silly me, I forgot to enable Macros ,But still have difficulties...
    I get Run time Error on this Line:
    VB Code:
    1. Set oCBmnuTools = Application.ActiveExplorer.CommandBars("Menu Bar").Controls("&Tools")
    Run time Error 5
    Invalid procedure call or argument

    Any Ideas?
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to record a macro in outlook2003?

    Just take the command bars part and try to print out the captions for your controls.
    VB Code:
    1. Dim i As Integer
    2. For i = 1 to Application.ActiveExplorer.CommandBars("Menu Bar").Controls.Count
    3.     Debug.Print Application.ActiveExplorer.CommandBars("Menu Bar").Controls(1).Name
    4. Next
    See if the Tools control is spelled the same and present.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    [RESOLVED]How to record a macro in outlook2003?

    Quote Originally Posted by RobDog888
    Just take the command bars part and try to print out the captions for your controls.
    VB Code:
    1. Dim i As Integer
    2. For i = 1 to Application.ActiveExplorer.CommandBars("Menu Bar").Controls.Count
    3.     Debug.Print Application.ActiveExplorer.CommandBars("Menu Bar").Controls(1).Name
    4. Next
    See if the Tools control is spelled the same and present.
    Hello RobDog888,
    OK It's working!!!
    two things:
    1)I forgot to tell you i'm using the hebrew version - that is why &tools is not recognized because the name is in hebrew.
    2)Debug.Print Application.ActiveExplorer.CommandBars("Menu Bar").Controls(1).Caption ->i got an error when tried to use Name

    Thank you so much for your help!!!
    Now i'll go and find how to do this from vb ->write a DLL That will be loaded when outlook launches.

    Best Regards,
    ERAN

    p.s.
    I gave it a resolved title but if you can please send me the other code we talked about ( toolbar example )...
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width