Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Feb 2015
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Userform in VBA Word

    Firstly, I am a green man in this matter

    I created a userform but that does not work in new documents
    and yet he is made under Normal.dotm when I look in the project brouwser
    Who can help me?

    next question is how can I get the value of a docproperty readout to a textbox?
    thx

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    What research have you done on this problem? Do a quick google search to find further resources and get your level of knowledge up a bit. Here are some useful links to get you started...
    http://www.gmayor.com/Userform.htm
    http://gregmaxey.mvps.org/word_tip_p..._userForm.html

    Which docproperty do you want to retrieve and what is the name of the textbox that you want to put it in? Some docproperties are 'built-in' and some are 'custom' so we need to know which one in particular you are trying to obtain.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Feb 2015
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Andrew Lockton View Post
    What research have you done on this problem? Do a quick google search to find further resources and get your level of knowledge up a bit. Here are some useful links to get you started...
    http://www.gmayor.com/Userform.htm
    http://gregmaxey.mvps.org/word_tip_p..._userForm.html

    Which docproperty do you want to retrieve and what is the name of the textbox that you want to put it in? Some docproperties are 'built-in' and some are 'custom' so we need to know which one in particular you are trying to obtain.
    Thx Andrew,

    I want to read out the current The custom doc properties before I change them,
    I tried this but it didn't work ; txtboxklantnaam = ActiveDocument.CustomDocumentProperties("klantnaam ")
    And yes I did some research without luck

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Can you post a sample document that contains this custom property? I would be surprised if a space was allowed in the name.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    New Lounger
    Join Date
    Feb 2015
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document

    KKKK_PPPPP_PCON001_B0-Protocol_Conform_algemeen_eng.zip
    Quote Originally Posted by Andrew Lockton View Post
    Can you post a sample document that contains this custom property? I would be surprised if a space was allowed in the name.

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    If I create a userform in that doc then the following works for me

    Me.TextBox1 = ActiveDocument.CustomDocumentProperties("Klantnaam ")
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    New Lounger
    Join Date
    Feb 2015
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Andrew Lockton View Post
    If I create a userform in that doc then the following works for me

    Me.TextBox1 = ActiveDocument.CustomDocumentProperties("Klantnaam ")

    It don't work like I have expected.
    The first time that I call the user-form the text boxes are empty,
    When I push “print” ( userform closed now) and when when I recall the user-form back then the textboxes are filled in whit the information from the document !
    you know why?
    Is the place from where I write Me.textbox.=...... determines the result

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    What macro did you put the code in? You need to initialise the form if you want the fields to be populated when the form loads?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #9
    New Lounger
    Join Date
    Feb 2015
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Andrew Lockton View Post
    What macro did you put the code in? You need to initialise the form if you want the fields to be populated when the form loads?
    Ok now it's working
    Thanks a lot for your helpfulness

    Regards
    Johan

Posting Permissions

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