Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

position problem for inlineshapes.addpicture in table cell

Status
Not open for further replies.

BennyJohansen

Technical User
Feb 10, 2011
3
Hi and thanks for reading my problem

I am currently trying to make a corporate outlook signature through programming.

I am almost there, but I keep having one annoying problem that I can't solve.

In our outlook signature I have created a table and in one table cell I want to add multiple pictures with some space between.

Now when I add these pictures they seem to be inserted at the beginning of the cell, meaning I get the reversed order, this is probably part of the problem or related.

Let me show a snippet of the vb script:

Set TwitterImg = objTable.Cell(4,2).Range.InlineShapes.AddPicture("\\server\path\twitter.gif")
objTable.Cell(4,2).Range.Hyperlinks.Add TwitterImg, "objTable.Cell(4,2).Range.Collapse 0
objTable.Cell(4,2).Range.InsertAfter " - "

Set FacebookImg = objTable.Cell(4,2).Range.InlineShapes.AddPicture("\\server\path\facebook.gif")
objTable.Cell(4,2).Range.Hyperlinks.Add FacebookImg, "objTable.Cell(4,2).Range.Collapse 0
'objTable.Cell(4,2).Range.InsertAfter " - "

So the FacebookImg pictures gets 1. place and the 2 text inserts both end up after the 2 images.

It seems to be like it is something to do with the insertion pointer, but how do I program the insertion pointer/cursor inside a table cell?

Hope somebody can offer a hint or solution

Best regards

Benny
 
hey

I solved the problem by adding a nested table inside a table cell, but this has brought me another problem.

When using inlineshapes.addpicture it always centers the image withing the cell, but I want it to be left aligned, so it matches the above text.

A little code:

If Len(strTwitter) > 0 Then
Set TwitterImg = objTable2.Cell(1,1).Range.InlineShapes.AddPicture("\\server1\path_to_img\twitter.gif")
objTable2.Cell(1,1).Range.Hyperlinks.Add TwitterImg, strTwitter
objTable2.Cell(1,1).Column.Width = 10
objTable2.Cell(1,1).Range.ParagraphFormat.Alignment = 0
End If

The last line should align the picture left, but this only works when it is text apparently, any one know how to do this when it is an inlineshape/picture?

Best regards

Benny
 
Well I solved the problem myself, it actually turned out to be paddings inside the table cell, setting left padding to zero removed the problem.

objTable2.LeftPadding = 0

But I can't see why this only has to be done when inserting inlineshapes and not for inserting text.

Best regards

Benny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top