Viewing 3 posts - 1 through 3 (of 3 total)
  • Word macro help – inserting pictures automatically.
  • Shakey
    Free Member

    Can anyone help me with Word macro's? I have a large table with a column for pictures, which I would like to put a unique number into which corresponds to a jpeg file in my pictures folder.

    Can I use a macro to automatically insert the pictures?

    Thanks Shakey

    Shakey
    Free Member

    Bump – anyone please help as this is doing my head in!

    joemarshall
    Free Member

    As long as you're using windows not mac, this little wonder macro should do the actual inserting a picture bit.

    Where I do CStr(CInt( that is just to make sure that we only have the number, and not any carriage returns / spaces / wacky table things around it.


    Sub Replace_Number_With_File()
    filenumber = CStr(CInt(Selection.Text))
    FileName = "c:\temp\arrow" + filenumber + ".png"
    Debug.Print FileName
    Selection.InlineShapes.AddPicture FileName, False, True
    End Sub

    Then you need to iterate over the table, and find the right cells, and find each filename that you want to do, select the right bit, and then stick it in. If you know VBA, it is pretty doable, just a little fiddly, I don't have the time to play with it myself (it is much easier if you have the actual target document to hand anyway). If you don't know VBA, well at least the macro above will let you select a single number and replace it with a picture.

    Joe

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Word macro help – inserting pictures automatically.’ is closed to new replies.