Results 1 to 30 of 30

Thread: Adding Button in Outlook Compose Window

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16

    Adding Button in Outlook Compose Window

    I am using VB to write an addin into the outlook. I can add an button on the outlook main interface, but how to add an button in the Compose interface?

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    One way then would be to modify the compose or 'Message' template.
    Go to Tools - Forms - Design Form...
    There you will find the form 'Message' for creating a new email messages.
    You may want to make a backup copy so you can restore if you make a mistake.
    Then after the Message form is displayed make you modifications and test it out by going to Form - Test Form.
    When all is well you are going to want to Publish the form so
    whenever you create a new email message it will show the changes you made.

    If you are going to plan on publishing this form for use on exchange at a business
    then you need to publish it to the exchange server I believe.

    You can also copy the form template and create your custom 'Compose' form.
    By doing this you will need to change the association on the Exchange server to use your custom form for all new emails.

    Form templates are with the extension of '.oft'
    It can be done, but it just depends on how you are going to be implementing it.

    If you want to do it totally through VB then its trickier.
    You will need to create the event in VB to so it will know when you click on the 'Compose' button.
    Then find the handel to the 'Compose' form window when it appears.
    Modify the form using APIs and then let it be shown.
    Create the event for the new button and your on your way.


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    Can u give me more guideline that I want to add in button in the "Compose" window, the button is used to add attachment instead of the original one. It invokes an interface design by myself instead of the original dialog box.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I should have something for you tomorrow night after work.
    Too much work! Had to bring work home over weekend.


  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    Well, really thanks~~

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Sorry for the delay, but I didn't forget. I have been busy at work.
    I think I can get the code working by the weekend.

    What I am doing is repointing the original attachment add's click event with your custom procedure.
    Its quite an interesting concept. I think when I finish this I will be
    using this for other addins and automation.

    Will post the working code soon!


  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I have the raw basics, but does your new procedure attach the file or is that
    code that still needs to be added?
    When I get home from work I will clean up the code and post for you.


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

    Its DONE!

    Here is the entire working example I promissed you.
    Its working GREAT.
    I added some error trapping for you also.
    Sorry it took so long, but I have been busy.
    If you have any questions let me know.
    Attached Files Attached Files
    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

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    Thanks ar~~

    But for me running the .exe directly, there is an msgbox error after pressing the Modify Menu button,

    ---------------------------------------------------------------
    91 - Object variable or With block variable not set
    ---------------------------------------------------------------

    Is it the code's problem, or I should run in another way?

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    I am using Outlook xp, will it compatible with it or Outlook 2000 or both?

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    This need to be run after Outlook is completly loaded.
    It can also be run as an Outlook Addin-Extender.
    This will invoke the exe after Outlook is started up.
    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
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    It should work on Outlook 2000 and Outlook XP.
    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

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Since you are running Outlook XP and I am running Outlook 2000
    you will need to go to (in vb window) Project properties > References > and add the reference to Outlook 10.0 and Office 10.0
    Then recompile. Where are you getting the error?
    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
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Also, check for the path to the attachment.
    I put in the attachment for "C:\RobDog888.txt"
    If its not in the directory then that may be the error.
    It was just a blank textfile to show how to do attachments.
    Comment out the lines for the attachment and test.
    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

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    It works~~ THANKS a lot!

    Now, i am trying to understanding your code.

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    There is a problem ...
    when I run it in desktop, with outlook xp, it works fine, but when i run it in notebook outlook 2000, there is problem.

    After pressing the Modify Menu button, a error message box

    -----------------------------
    5 - Invalid procedure call or argument
    -----------------------------

    I am not sure why there is such a problem... but my friend also have the same error.

    Will a different language interface affects it?

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You mean that your windows 2000 laptop has a different language than english?

    The only thing I can think of is if the menus are in a different language than
    it will definately crash.
    You will need a different compile for different languages.

    You can test if you have VB on the laptop?
    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
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: There is a problem ...

    Did you remenber to add the text file for the attachment on your laptop?
    Or did you comment out the attachment code?
    My code has a file ref. of "C:\RobDog888.txt"
    If you create a new text file in that location and name it as such, it will work.
    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

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    After looking into the code, I have quite a few question that want to ask you, hope that you won't mind spending some time to answer me.

    1)
    ' <ROBDOG888 04/11/03 - FOR NAVIGATION FROM ORGIN TO INBOX>
    Set olNS = olApp.GetNamespace("MAPI")
    Set moFromWhere = olApp.ActiveExplorer.CurrentFolder
    ' <ROBDOG888 04/11/03 - NAVIGATE TO INBOX WINDOW>
    Set olApp.ActiveExplorer.CurrentFolder = olNS.GetDefaultFolder(6)

    ' <ROBDOG888 04/11/03 - CREATE THE EMAIL SO WE CAN OBTAIN ACCESS TO THE MENU>
    Set olEmail = Outlook.Application.CreateItem(olMailItem)


    Is it needed to do the above setting? I am not sure why have to write this.


    2)
    Set olEmail = Outlook.Application.CreateItem(olMailItem)
    olEmail.Save '// <- why is it needed to save here?
    Set olAttach = olEmail.Attachments
    olEmail.Importance = olImportanceHigh
    olEmail.Subject = ""
    olEmail.To = ""
    olEmail.Save '// <- why is it needed to save here?
    olEmail.Display


    3)
    moCBInsertNew.Tag = "888"
    Could you tell me what's Tag for?


    4)
    Currently, it is executed as .exe. But how can I embed the button into the composer interface "permanently" that whenever i click on the "New" button, it invokes the compose interface with the button ready?
    (Currently, I have an addin for Outlook, by using the Addin Designer in VB, that is a .dll. Can I do it through the Addin Designer)


    THANKS~~~

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    1.) It is necessary to change (Navigate) to the Inbox because when you create an email
    it is usually from the Inbox and not from some other folder. If you create
    are in some other folder the new button corresponds to that type.
    Ex. if you are in the Calendar and you create new it will be a new appointment item not email.
    Also, the toolbar changes slightly in which items are displayed.

    The second part or #1 is necessary (the CreateItem) because we need to be able to have access to the email menus and toolbars.
    If they are not displayed then we can not modify them.

    2.) It is recommended by Microsoft to save an email before any attachments are
    added to the message. The second .save is only so if they delete the message
    it will not prompt them if they want to save any changes.
    So, the second .save is really not to important.

    3.) The .Tag property is used to identify the button. If the user
    clicks on the Modify button more then once it will check to see if
    the button already exists by using the find method. If it finds the
    button with the .Tag = 888 then it knows the button has been
    applied already. I don't think you are going to weant multiple
    buttons if the user clicks on Modify more than once.

    4.) You can make it run at the startup of Outlook by making it an
    Outlook Addin using the Tools > Options > Advanced Options > COM Addin...
    The only thing is that the code has to be changed to make it an Addin.
    I do believe you can use the vb addin designer, but with major modifications to the code.
    I'm not too positive on how to change it for Outlook instead of VB addin.
    I can find out though. I have an Outlook Reference book and there is a chapter for creating Outlook Addins.
    I will reread it again when I get home tonight since it has been a while.
    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

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    In your program, it terminates after user click on close.
    For me, i hide the "form" with close button to user, and I want to terminate it when user click on "Send" on the compose interface. How can I do it?

    I see that olEmail has a event "sent", but i am not sure how to include it to make it works... so that i can detect the email is sent
    Last edited by chpchai; Apr 19th, 2003 at 03:34 AM.

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    This is going to be harder. What exactly do you want to accomplish?

    If you just need to determine if the email has been sent then -
    the easiest thing to do is to detect if the email with a certain
    subject has been sent by checking to see if its in the Sent folder
    then you know its sent. As long as you have the option to save a
    copy of all outgoing emails to the Sent folder selected.

    If you want some kind of action to be performed when they click
    on the Send button then it is allot harder.
    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

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    After looking deeper into it. I believe it can be done with minimal effort.
    Just replicate the method I used for the toolbar button and menu items.
    I can post the code to be ammended in a few.
    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

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I have almost everything working, but I am receiving an
    automation error when I get to the line that actually sends it.
    I have invoked the send button before for another example,
    but somehow its not the same when used in an event.

    Its time for a break, going for a drive.
    Be back.
    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

  25. #25

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    ha, i find a stupid but quite a easy method to end the program automatically.

    i add an timer whose interval is 0.1s, then check for the the number of inspectors as follow,

    If olApp.Inspectors.Count = 0 Then
    endProgram
    End If

    if the message has been snet or close, it will = 0.

  26. #26
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    There may be a problem with that approach. If the user just
    saves the new email it will go to the Drafts folder and your code
    will not detect it.
    The Inspectors object is only for open inspectors. If they delete,
    save to drafts folder or send it, it will not detect any inspectors.
    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

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    Aside:

    There is something I would like to ask u, but not related to current topic.

    I have a add-in for outlook written by VB designer, which adds a button in the outlook interface and invoke a form when the button clicked.

    However, it works only in "some" outlook. But some can't work, when outlook is open, there is a error msg box telling me to examine my code.

    Have you encounter this situation before?

    The function that run on when outlook is invoked
    =============================================
    Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    On Error GoTo error_handler

    Set oAppInstance = Application
    Set oOutlookAE = Application.ActiveExplorer
    Set oSelection = Application.ActiveExplorer.Selection

    Set myBar = oOutlookAE.CommandBars.Add(Name:="OfficeDL Tool Bar", Position:=msoBarTop, Temporary:=True)
    Set myButton = myBar.Controls.Add(1)

    myBar.Visible = True

    With myButton
    .Caption = "Office DL - Save and Categorize"
    .DescriptionText = "Save current document and categorize it for OfficeDL"
    .Style = msoButtonIconAndCaption
    .FaceId = 250
    .Visible = True
    End With

    Set myButton2 = myBar.Controls.Add(1)
    With myButton2
    .Caption = "Office DL - New Email!"
    .DescriptionText = "Create new email with attachment from OfficeDL"
    .Style = msoButtonIconAndCaption
    .FaceId = 250
    .Visible = True
    End With

    Exit Sub

    error_handler:
    MsgBox Err.Description

    End Sub
    Last edited by chpchai; Apr 21st, 2003 at 12:43 AM.

  28. #28
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Can you post the actual Err.Description for me?
    Also, when you say that it only runs on some Outlooks, what is the
    version that it does/doesn't run on? Or if they are the same
    versions, what are the differences between them?

    Corporate/Workgroup configuration?
    Internet Only?
    No Email?
    Working on line or off line, etc.
    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

  29. #29

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Posts
    16
    the Err.Description is in chinese actually, haha... as so far, it occurs in some version of outlook which is chinese version. I am suspecting that is the language problem? (but it does work in one chiense version outlook!)

    The error occurs when the outlook is just open and the addin is just loading.

    For the configuration:
    It is used in a local computer, no Corporate/Workgroup configuration.

    I think its Internet Only?

    No Email? (<-what u mean actually?, but there are emails in the account)

    And its working on line!

  30. #30
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    These are the types of configuration for Outlook.
    1.) Corporate/Workgroup configuration
    2.) Internet Only
    3.) No Email

    So I take it that it is configured for 2 - Internet Only.

    It is very difficult to determine the issue if I don't know the exact
    error. One thing I can suggest is to try to add some code to
    log all actions your code. then when you get the error, you will
    have some information to track down the issue.
    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

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