none
MS Publisher - Commands on userform not executed without Visual Basic Open RRS feed

  • Question

  • Hi Developer network, 

     I have a problem in a MS Publisher file, where my Userform is not behaving as intented. I have linked to the file here as well. The button on my userform works great when I have "Visual Basic" open, but If I just try to execute the macro, which open up the form, the button are not working. 

    My code is the following for reproducing the issue. 

    Public Sub OpenForm()
        UserForm1.Show
    End Sub
    
    Private Sub CommandButton1_Click()
        MsgBox "how"
    End Sub
    The CommandButton1 is located in the UserForm file. 

       Link to basic file: http://folmer-it.dk/stackoverflow/template_v2_09_07_2018.pub

    I have the following references, standard when creating a new form. 

    

    I have tried this link:  

    https://support.microsoft.com/en-gb/help/308340/how-to-check-and-remove-incorrect-project-references-in-the-visual-bas

    But this is not possible on the Publisher project, because of the missing VBProject part of the document. 

    Any help will be very appreciated. 

    Best Regards 

      Lars Folmer-Petersen


    Lars Folmer-Petersen

    Wednesday, July 18, 2018 6:59 AM

Answers

  • Hello Lars,

    Thanks for sharing your operation details. I could reproduce your issue now.

    It seems an issue while open the user form in modal in publisher. I did not reproduce the issue on other Office application. I would suggest you go to File->Feedbacks to make a feedback for the issue.

    Currently, I would suggest you change your userform show modaless or open the form in modaless as workaround.

    Public Sub OpenForm()
        UserForm1.Show 0
    End Sub

    Or

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by FolmerIT.dk Tuesday, July 24, 2018 10:13 AM
    Thursday, July 19, 2018 6:33 AM

All replies

  • Hello Lars Folmer-Petersen,

    >>The button on my userform works great when I have "Visual Basic" open, but If I just try to execute the macro, which open up the form, the button are not working. 

    Do you mean if you run the userform directly, the button click works. However, if you use the OpenForm macro to open the form, does the button click not work?

    If so, I do fail to reproduce your issue. What's the building number of your Office? Have you tried to repair your office?

    Could you reproduce the issue on other PC?

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 19, 2018 2:15 AM
  • Hi Terry, 

     I'm able to reproduce my error on 3 different machines, all of them are using Office 365 publisher. 

         Publisher build number: 10228.20104 (version: 1806) - Danish language

    The button are not executing when I run it like this: 

    

    I have tried to do a repair of my Office, but no change on it. 

    Best Regards

      Lars 


    Lars Folmer-Petersen


    • Edited by FolmerIT.dk Thursday, July 19, 2018 6:22 AM
    Thursday, July 19, 2018 6:05 AM
  • Hello Lars,

    Thanks for sharing your operation details. I could reproduce your issue now.

    It seems an issue while open the user form in modal in publisher. I did not reproduce the issue on other Office application. I would suggest you go to File->Feedbacks to make a feedback for the issue.

    Currently, I would suggest you change your userform show modaless or open the form in modaless as workaround.

    Public Sub OpenForm()
        UserForm1.Show 0
    End Sub

    Or

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by FolmerIT.dk Tuesday, July 24, 2018 10:13 AM
    Thursday, July 19, 2018 6:33 AM
  • Hi Terry, 

     Thanks, it is working fine, when I set the ShowModal = false

     I will report it as you suggested. 

    Best regards

      Lars 


    Lars Folmer-Petersen

    Tuesday, July 24, 2018 10:13 AM