- Home
·
- Miscellaneous
·
- This code snippet will mail mereg an image into a word document, can easily be made into a function
This code snippet will mail mereg an image into a word document, can easily be made into a function
This code snippet will mail mereg an image into a word document, can easily be made into a function to perform same. I am not claiming
Rate This code snippet will mail mereg an image into a word document, can easily be made into a function
(1(1 Vote))
'add a reference to the word 8.0 library (not tested it with 9.0)
'set MyImage variable to a valid path to an image
'i think using this method will also allow you to insert the image
'into a bookmark so you always know where it is going to go
'but I have never done it
Private Sub Command1_Click()
'declare variables
Dim wrdselection As Word.Selection
Dim MyImage As String
'create instance of word object
Set wrdapp = CreateObject("Word.Application")
'set path to image
MyImage = "C:/is200se.jpg"
'show the word document
wrdapp.Visible = True
'add a new document to word object
Set wrddoc = wrdapp.Documents.Add
'set up a selection area in document to add to
Set wrdselection = wrdapp.Selection
'add the picture to the selection area
wrdselection.InlineShapes.AddPicture MyImage
Set wrdselection = Nothing
Set wrdapp = Nothing
Set wrddoc = Nothing
End Sub
This code snippet will mail mereg an image into a word document, can easily be made into a function Comments
No comments yet — be the first to post one!
Post a Comment