Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
i am trying to create a Text object Object using macro below is the code.
set obj = ActiveDocument.ActiveSheet.CreateTextObject
prop = obj.GetProperties
'Image Presentation
prop.Layout.Text.v = "= 'qmem://ImageId/arrowU_off'
prop.Layout.ImageRepresentation.Presentation=1
prop.Layout.ImageStyle.StrechMode=0
i am able to create a text object which represent Image successfully, but issue is that Image StrectMode is ON which i want to OFF by using macro only i have tried the code prop.Layout.ImageStyle.StrechMode=0 but this is not working.
Please help how to do this.
Thanks & Regards,
Jitendra Kumar.
Hi Jitendra,
I have found it after a long search. But I felt frustrating to search the correct syntax to access the properties through macro. Lack of examples in API guide.
Sub Test
set obj = ActiveDocument.ActiveSheet.CreateTextObject
prop = obj.GetProperties
'Image Presentation
prop.Layout.Text.v = "= 'qmem://ImageId/arrowU_off' "
prop.Layout.ImageRepresentation.Presentation=1
prop.Layout.ImageRepresentation.CellImageStyle.StretchMode = 0
obj.SetProperties prop
End Sub
Let me know.
In you code I can't find a
obj.SetProperties prop
Which is necessary to activate the changes you have made on the object you are manipulating...
Hi Jitendra,
Try the below syntax,
prop.Layout.BkgImageSettings.ImageStyle.StretchMode = 0
In code i am doing obj.SetProperties prop
Hi Tamil Nagaraj,
i have tried that. its did not giving me any error but still it not working.
Hi Tamil Nagaraj,
using you code is changing red marked properties, i want to change blue marked property of text object.
Hi Jitendra,
I have found it after a long search. But I felt frustrating to search the correct syntax to access the properties through macro. Lack of examples in API guide.
Sub Test
set obj = ActiveDocument.ActiveSheet.CreateTextObject
prop = obj.GetProperties
'Image Presentation
prop.Layout.Text.v = "= 'qmem://ImageId/arrowU_off' "
prop.Layout.ImageRepresentation.Presentation=1
prop.Layout.ImageRepresentation.CellImageStyle.StretchMode = 0
obj.SetProperties prop
End Sub
Let me know.
Thanks Tamil nagaraj,
Its working fine.
Agree with your point i am also very frustrated to search the correct syntax.
Is it also possible to set actions via macro? like when creating the textbox to set actions like run a macro?
Yes. It is possible. I would suggest you to create a new discussion since this one is already closed and more than 2 year old. Hope this is fine with you. Don't forget to mention my name after creating a new discussion, so that I'll get a notification. Have a nice day.