Link to home
Start Free TrialLog in
Avatar of Vitaly Pshenichnii
Vitaly Pshenichnii

asked on

Control picture in text box

I place  signature picture to textbox programmatically using bookmark and try to control it'sdeletetion by user with AlternativeText property.
Here Power Builder script:
If lole_Word.ActiveDocument.Bookmarks.Exists("signature_image") = True Then
   lole_Word.ActiveDocument.Bookmarks.Item("signature_image").Select()
   lole_Word.Application.Selection.InlineShapes.AddPicture(is_sign_filename, False, True)
   ll_count = lole_Word.ActiveDocument.InlineShapes.Count
   if ll_count > 0 then        lole_Word.ActiveDocument.InlineShapes[ll_count].AlternativeText=_'sign_image_name'             lole_Word.ActiveDocument.Bookmarks.Item("signature_image").Delete()
      end if
End If

But ll_count does not changes and new picture does not appears in This.ole_word.Object.Application.ActiveDocument.Shapes[].
How I can control if signature picture exists in document?
There is no problem when I pplacing picture to main document, only with textbox.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vitaly Pshenichnii
Vitaly Pshenichnii

ASKER

Thank you,
key phrase is "InLineShapes collection because it is in another StoryRange".
With this I have found the solution how to find signature  image   in the document too:

// to check if exists sign image in document marked with AlternativeText = as_var
Long     ll_count, ll_count_in_shape
Long     ll_i, ll_j
Boolean  lb_exists

ll_count = This.ole_word.Object.Application.ActiveDocument.Shapes.Count
FOR ll_i = 1 TO ll_count
      This.ole_word.Object.Application.ActiveDocument.Shapes[ll_i].Select()
      ll_count_in_shape = This.ole_word.Object.Application.Selection.InlineShapes.Count
      FOR ll_j = 1 TO ll_count_in_shape
             If This.ole_word.Object.Application.Selection.InlineShapes[ll_j].AlternativeText = as_var Then
                   lb_exists = true
                   exit
             end if
      NEXT
NEXT


Is it possible to do better?