I'm putting together a VBA form in Word 2007, and am trying to change the picture field of a label based on a flag variable. As i understand, the picture field is a string comprising the path of a bitmap. When i try to set it equal to a string variable containing an image path, i get a type mismatch compile error. I have tested, and both strings do point to images, complete with '.bmp' extension. The offending code follows:
If flag1 Then
Makashi.Back1.Picture = dark
Else
Makashi.Back1.Picture = bright
End If
If it matters, Back1 is a label on the Makashi user form.
What am i doing wrong? Is this impossible, and i should instead make two overlapping labels, one of them occasionally invisible? Is there some other way to do this?
Assuming dark
and bright
are path\file strings (e.g. dark = "c:\test.bmp"), try:
If flag1 Then
Makashi.Back1.Picture = LoadPicture(dark)
Else
Makashi.Back1.Picture = LoadPicture(bright)
End If