Run macro in Word 2010 from Webbrowser button click

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Hi,

    Hopefully I post it in the right forum.

    I have a userform in a Word 2010 application with a webbrowser object in it.
    Before i show this userform, i create the needed HTML code to open in the webbrowser.
    The HTML code represent a labelsheet (A4), and the table rows & columns varry with the selected label sheet.
    Obvious, this depends on the number of labels across and down on the label sheet.

    In fact, it's only a table with a button in each table cell.

    Because there's no Click event in the webbrowser object, I can't get its Row / Column value when I click in a table cell.

    The probem i have is that i can't figure out what the HTML syntax is to run a subroutine from within the same userform.
    The purpose is to retreive the table row & column number when i click a button.

    the OnClick line give me always an error like:
    Error 20 Permission denied
    line: 45
    char: 30
    error: Expected ";"
    code: 0
    URL: .....

    when i remove this line i don't get this error anymore.

    I would appreciate it if anyone can help me to solve this problem.

    here's part of the generated HTML code:

    and here's the test code from the Word subroutine that need to run when click on a button (need to be tuned).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!