PDA

Click to See Complete Forum and Search --> : [RESOLVED] how can I add a Picture into table? (WORD)


Baloo
Feb 9th, 2006, 12:58 PM
hi, all!
I have: 'I've got it from a recorded macro. It works:
Selection.InlineShapes.AddPicture FileName:= _
"C:\MyPicture.jpg", LinkToFile:=False, SaveWithDocument :=True
'AND REFERENCE TO MY TableSTRING:
Set String1 = Table1.Rows.Add

But how can I add Picture into string without "Selection."
I've tried:
String1.Cells(2).Range.AddPicture...
& String1.Cells(2).Range.InlineShapes.AddPicture...
it doesn't work:(

Help me please!
kind regards,
Baloo.

cssriraman
Feb 10th, 2006, 05:43 AM
Here is the problem:Set String1 = Table1.Rows.AddHere you need to mention which table you are going to work. It may be the table where the cursor located or may be the table no. in the active document. So, it popups the error.

Here is the code for you.Dim String1 As Range
'table where the cursor located
Set String1 = Selection.Tables(1).Range
'the 1st table of the current document
'Set String1 = ActiveDocument.Tables(1).Range

String1.Tables(1).Cell(1, 2).Range.InlineShapes.AddPicture filename:= _
"C:\Clip.gif", LinkToFile:=False, SaveWithDocument:=True

'String1.Tables(1).Cell(1, 2).Range.InlineShapes.AddPicture filename:= _
"C:\Clip.gif", LinkToFile:=False, SaveWithDocument:=True

Baloo
Feb 12th, 2006, 09:58 AM
it works!!! :D
CSSRIRAMAN,THANKS A LOT :thumb:

kind regards,
Baloo.