PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] outlook- the macros in this project are disabled?-VBForums
Results 1 to 12 of 12

Thread: [RESOLVED] outlook- the macros in this project are disabled?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Resolved [RESOLVED] outlook- the macros in this project are disabled?

    for some reason I can't run VBA macros in Outlook, eventhough Security level is set to low.

    any ideas?

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,697

    Re: outlook- the macros in this project are disabled?

    Is your code in the ThisOutlookSession? Restarted Outlook?
    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

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Re: outlook- the macros in this project are disabled?

    Yes, and Yes.
    I've reduced the code to:

    Private Sub Application_Startup()
    MsgBox "test"
    end sub

    still doesn't work

  4. #4
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,697

    Re: outlook- the macros in this project are disabled?

    Try something like this.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Application_MAPILogonComplete()
    4.     MsgBox "Test"
    5. End Sub
    Make sure when you restart Outlook its no longer running in the system tray or running processes list and security is Medium or Low for testing purposes only and your code looks like this....
    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

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Re: outlook- the macros in this project are disabled?

    found the problem: Outlook was still runing as a process, although not running as an application.

    thanks!

  6. #6
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,697

    Re: [RESOLVED] outlook- the macros in this project are disabled?

    No prob.

    But you should be using the MAPILogonComplete to do anything as its the last event to run and prevents most startup issues involving Outlook no being finished initializing before running vba or add-in code.
    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

  7. #7
    New Member
    Join Date
    May 2008
    Posts
    1

    Thumbs up Re: [RESOLVED] outlook- the macros in this project are disabled?

    Thanks!!

    Finally, after an hour of searching and asking around I stumble on this post.

    I had the exact same problem. And as an additional side effect my Outlook couldn't sent it's mail either! (there were some tasks requests in my outbox created by a macro, I suppose perhaps that was why?)

    What I did, I had to enable the macros via Tools > Trust Center (is that new?!) and Macro Security.

    Thereafter I still had the problem despite restarting Outlook. The key was to also kill the Outlook process.

    Thanks for the tip!

  8. #8
    New Member
    Join Date
    Aug 2012
    Posts
    1

    Re: [RESOLVED] outlook- the macros in this project are disabled?

    Sorry, I don't know if anyone is still monitoring this thread or not, but I hope so. I have the same problem, but I have ended all Outlook (and Microsoft Office just in case) processes and it's still not running. The code is good as far as I can tell, and I have checked my security settings, enabled macros, etc., etc., and I'm so frustrated. It was working last week, and now... It's just not! Someone please help!

  9. #9
    New Member
    Join Date
    Aug 2012
    Posts
    3

    Re: [RESOLVED] outlook- the macros in this project are disabled?

    Hi,

    In my opinion, you need to create a selfsigned certificate in order to be able to create/launch your macro on Outlook. It will work the first time you are coding but then you will be blocked.

    It depends if you are doing this at home or at work but if you are at work I'm pretty sure you will need to create a cert.

    To do so :

    The "macro security settings" is fixed to : "notifications for digitally signed macros, all other macros disabled". You can create a certificate with SelfCert.exe ( Into C:\Program Files (x86)\Microsoft Office\Office14\)
    Then to sign the macro you will have to put the certificate in the trusted publishers within the visual basic editor of Outlook.

    Hope this help.

  10. #10
    New Member
    Join Date
    Dec 2019
    Posts
    2

    Re: outlook- the macros in this project are disabled?

    Hello, I am having a similar problem. The first time I entered and used the code below, all worked well. However, since restarting Outlook it won't work regardless of the settings for macros. Below is the code I am using, what would you recommend to resolve? Any assistance would be greatly appreciated.

    Code:
    Option Explicit
    Public Sub SaveMessageAsMsg()
      Dim oMail As Outlook.MailItem
      Dim objItem As Object
      Dim sPath As String
      Dim dtDate As Date
      Dim sName As String
      Dim enviro As String
     
        enviro = CStr(Environ("USERPROFILE"))
       For Each objItem In ActiveExplorer.Selection
       If objItem.MessageClass = "IPM.Note" Then
        Set oMail = objItem
       
      sName = oMail.Subject
      ReplaceCharsForFileName sName, "-"
     
      dtDate = oMail.ReceivedTime
      sName = Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
        vbUseSystem) & Format(dtDate, "-hhnnss", _
        vbUseSystemDayOfWeek, vbUseSystem) & "-" & sName & ".msg"
         
        sPath = enviro & "\Documents\"
      Debug.Print sPath & sName
      oMail.SaveAs sPath & sName, olMSG
      
      End If
      Next
      
    End Sub
     
    Private Sub ReplaceCharsForFileName(sName As String, _
      sChr As String _
    )
      sName = Replace(sName, "'", sChr)
      sName = Replace(sName, "*", sChr)
      sName = Replace(sName, "/", sChr)
      sName = Replace(sName, "\", sChr)
      sName = Replace(sName, ":", sChr)
      sName = Replace(sName, "?", sChr)
      sName = Replace(sName, Chr(34), sChr)
      sName = Replace(sName, "<", sChr)
      sName = Replace(sName, ">", sChr)
      sName = Replace(sName, "|", sChr)
    End Sub

  11. #11
    New Member
    Join Date
    Dec 2019
    Posts
    2

    Re: outlook- the macros in this project are disabled?

    Hello, I am having a similar problem. The first time I entered and used the code below, all worked well. However, since restarting Outlook it won't work regardless of the settings for macros. Below is the code I am using, what would you recommend to resolve? Any assistance would be greatly appreciated.

    Code:
    Option Explicit
    Public Sub SaveMessageAsMsg()
      Dim oMail As Outlook.MailItem
      Dim objItem As Object
      Dim sPath As String
      Dim dtDate As Date
      Dim sName As String
      Dim enviro As String
     
        enviro = CStr(Environ("USERPROFILE"))
       For Each objItem In ActiveExplorer.Selection
       If objItem.MessageClass = "IPM.Note" Then
        Set oMail = objItem
       
      sName = oMail.Subject
      ReplaceCharsForFileName sName, "-"
     
      dtDate = oMail.ReceivedTime
      sName = Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
        vbUseSystem) & Format(dtDate, "-hhnnss", _
        vbUseSystemDayOfWeek, vbUseSystem) & "-" & sName & ".msg"
         
        sPath = enviro & "\Documents\"
      Debug.Print sPath & sName
      oMail.SaveAs sPath & sName, olMSG
      
      End If
      Next
      
    End Sub
     
    Private Sub ReplaceCharsForFileName(sName As String, _
      sChr As String _
    )
      sName = Replace(sName, "'", sChr)
      sName = Replace(sName, "*", sChr)
      sName = Replace(sName, "/", sChr)
      sName = Replace(sName, "\", sChr)
      sName = Replace(sName, ":", sChr)
      sName = Replace(sName, "?", sChr)
      sName = Replace(sName, Chr(34), sChr)
      sName = Replace(sName, "<", sChr)
      sName = Replace(sName, ">", sChr)
      sName = Replace(sName, "|", sChr)
    End Sub

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,620

    Re: [RESOLVED] outlook- the macros in this project are disabled?

    you should have started this in a new thread

    you should supply more information
    is this in a single user situation or a domain using exchange server?
    if the latter have you contacted the IT support?
    i am sure you are not using the same version of outlook that was involved in the original thread, so specify

    have tried all the suggestions in this thread, especially to make sure that outlook is not running in task manager
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width