Results 1 to 10 of 10

Thread: Remove Excel Userform Using VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    It is an application setting, so you will need to make sure that theirs is set too.

    You can check it with this code, and tell the users what to do if it is not.

    Function VBAIsTrusted() As Boolean
        Dim mpVBC As Object
        Dim mpAlerts As Boolean
        mpAlerts = Application.DisplayAlerts
        Application.DisplayAlerts = False
        On Error Resume Next
        Set mpVBC = ThisWorkbook.VBProject.VBComponents.Item(1)
        On Error GoTo 0
        Application.DisplayAlerts = mpAlerts
        VBAIsTrusted = Not mpVBC Is Nothing
    End Function
    Last edited by Aussiebear; 01-01-2025 at 11:50 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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