Results 1 to 3 of 3

Thread: [RESOLVED] how can I add a Picture into table? (WORD)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    26

    Resolved [RESOLVED] how can I add a Picture into table? (WORD)

    hi, all!
    I have:
    VB Code:
    1. 'I've got it from a recorded macro. It works:
    2.     Selection.InlineShapes.AddPicture FileName:= _
    3.           "C:\MyPicture.jpg", LinkToFile:=False, SaveWithDocument :=True  
    4.     'AND REFERENCE TO MY TableSTRING:
    5.     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.
    Last edited by Baloo; Feb 9th, 2006 at 02:28 PM.

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: how can I add a Picture into table? (WORD)

    Here is the problem:
    Set String1 = Table1.Rows.Add
    Here 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.
    VB Code:
    1. Dim String1 As Range
    2. 'table where the cursor located
    3. Set String1 = Selection.Tables(1).Range
    4. 'the 1st table of the current document
    5. 'Set String1 = ActiveDocument.Tables(1).Range
    6.  
    7. String1.Tables(1).Cell(1, 2).Range.InlineShapes.AddPicture filename:= _
    8.         "C:\Clip.gif", LinkToFile:=False, SaveWithDocument:=True
    9.  
    10. 'String1.Tables(1).Cell(1, 2).Range.InlineShapes.AddPicture filename:= _
    11.         "C:\Clip.gif", LinkToFile:=False, SaveWithDocument:=True
    Last edited by cssriraman; Feb 10th, 2006 at 06:46 AM.
    CS

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    26

    Resolved Re: how can I add a Picture into table? (WORD)

    it works!!!
    CSSRIRAMAN,THANKS A LOT

    kind regards,
    Baloo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width