VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code snippet will mail mereg an image into a word document, can easily be made into a function

by DaveFD (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 1st July 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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

Download this snippet    Add to My Saved Code

This code snippet will mail mereg an image into a word document, can easily be made into a function Comments

No comments have been posted about This code snippet will mail mereg an image into a word document, can easily be made into a function. Why not be the first to post a comment about This code snippet will mail mereg an image into a word document, can easily be made into a function.

Post your comment

Subject:
Message:
0/1000 characters