Adding picture into activedocument shapes

Discussion in 'Word VBA Beginners' started by baha, Aug 14, 2011.

  1. baha

    baha Guest

    Hi Everyone,
    I have a following code for adding bmp pictures which are named from
    1 to 250, into activedocument shapes which are named from image1 to
    image250. It seems like I am doing something wrong.Any help?
    My code is
    Private Sub CommandButton1_Click()
    Dim i As Variant
    For i = 1 To 250
    ActiveDocument.Shapes("Image" & i).OLEFormat.Object.Object.Picture =
    LoadPicture(ThisDocument.Path & "\Pictures\" & i & ".BMP")
    Next i
    End Sub

    Thanks in advance
    Baha
     
    baha, Aug 14, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.