VBA - paste picture into word from path

MMasiarek

New Member
Joined
Mar 2, 2021
Messages
20
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello All :)

Currently I have vba code:
VBA Code:
'Some code above

If OfertomatMain.cmbUnderwriter1.Value <> "" Then

For b = 2 To 20 Step 1
    If OfertomatMain.cmbUnderwriter1.Value = wudoc.Cells(b, 1).Value Then
        Let underwriterstanowisko1 = wudoc.Cells(b, 2).Text
        Let underwriterfaksymila1 = wudoc.Cells(b, 6).Text
    End If
Next

Let i = wddoc.Paragraphs.Count

    With wddoc.Paragraphs(i)
        ' Insert the picture into the specified paragraph
        .Range.InlineShapes.AddPicture fileName:=underwriterfaksymila1, LinkToFile:=False, SaveWithDocument:=True
        .Range.InsertAfter vbCr & vbCr
    End With

Let i = wddoc.Paragraphs.Count

    With wddoc.Paragraphs(i)
         .Range.InsertAfter OfertomatMain.cmbUnderwriter1.Text & vbCr & underwriterstanowisko1 & vbCr & vbCr
    End With

End If

This code should check if combobox is not empty, if true, then it should search for value in first and sixth column in wudoc.
In sixth column there is a path to the jpg file, which should be pasted to the word document on which whole my code is working.
Path to the jpg pic is like: Y:\Sample\faksymile\picture.jpg
All pictures are stored on share drive.

Can you assist me with this issue?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top