Consulting

Results 1 to 2 of 2

Thread: Auto/Prefill Macro wont run on 'show' or 'initialize' of userform text-boxes.

  1. #1
    VBAX Newbie
    Joined
    Jul 2019
    Posts
    2
    Location

    Auto/Prefill Macro wont run on 'show' or 'initialize' of userform text-boxes.

    Hi there,

    I have a userform with several text-boxes. These text-boxes are linked to custom property fields that I have set up in a word doc. I have an action button with working code to allow these text-boxes to fill with the values sitting in the custom fields. I want to have this sub run automatically when the userform opens.
    If I can get the textboxes to prefill on userform opening, I would then make the mentioned action button an update/refresh button.

    userform1.jpg

    This is what I think should work for running auto filling the text-boxes on start up. 'DocumentPropertyFieldValues' is the name of the userform.

    Public Sub showDialogueBox_Click()


    DocumentPropertyFieldValues.Show


    DisciplineInput.Text = ActiveDocument.CustomDocumentProperties("DisciplineField").Value

    'Code repeats for the other fields until
    End Sub



    This is the code for running it with an action button on the usedform which works.

    Private Sub PrefillDetails_Click()
    DisciplineInput.Text = ActiveDocument.CustomDocumentProperties("DisciplineField").Value

    'other fields and then
    end sub
    Attached Images Attached Images

  2. #2
    VBAX Newbie
    Joined
    Jul 2019
    Posts
    2
    Location
    Solved. New macro to call up form, and include name of the userform in each relevant line of the code. duh. haha

Posting Permissions

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