Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Control, changing image source

    Hi!

    I have a UserForm in Word 2003, and I have an image control on it. I'd like to change the image displayed in the control based on a combo box. The problem is that I can't figure out what property to change of the image control. When you put a picture in an image control, you do it in the .Picture property, but apparently that can't be done in VB code in Word? (in Access it's soooo much easier )

    So there's a whole bunch more properties of the image control that are revealed in the VB(A) editor, such as .ControlSource and .RowSource, but I can't figure out what they're for, but setting what image is displayed in the image control isn't a function of any of them either...?

    Ultimately, my goal is to have a user pick a choice from a combo box, which will display certain things on the form, which will then populate into the Word document. I've got everything running fine (ie. all the text populates and inserts) except the image.

    Anyone got any suggestions or samples that might help?

    Thanks!

    Cecilia

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Hi Cecilia,

    Not sure how to change the .Picture property via code, but a 'cheat' method that might be workable if you don't have too many pictures is to create and name a separate picture control for each different picture. Then superimpose them all in the same place on the form. The code that responds to the combo box selection can set the relevant picture control to .Visible = True and all the others to .False.

    Alternatively you can create and load a picture for each control, and then in the IDE set its Left and Top properties so that it's located off the form. And then use the combo box code to bring the picture control you need, to the correct Top and Left location.

    Gary

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, Gary...that's a nice "outside the box" solution. I'll try it, but I think I have too many images (so far I'm up to 12, and possibly a few more than that), it'll probably slow things down considerably.

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Have you tried the method described in the help file?

    object.Picture = LoadPicture( pathname )
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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