We have an web application that we use that gathers information from our database to print a follow up letter to customers. I am having some trouble getting it to put an image into a word document though.
The code that is in bold and red is what I have been playing around with. As you can see from the following, we have a link that when clicked, it will pull our Rep's name and phone number, as well as the customer name/address, etc. We would like it to also pull a pic depending on what rep it is. I am just not sure how to code that properly. Any help is appreciated. TIA!
Enkrypted
A+
Code:
Function wrdFollowupLetter(custname, custa1, custa2, custnamesal, repname, repphone)
'response.write "Custname: " & Custname & " / CustA1: " & custa1 & " / CustA2: " & custa2 & " / CustSal: " & custnamesal & " / Repname: " & repname & " / Repphone: " & repphone & "<br>"
'RESPONSE.FLUSH
Const wdSaveFormat = 1
Set oWord = CreateObject("Word.Application")
oWord.DisplayAlerts = false
oWord.Visible = False
Set oDoc = oWord.Documents.Add("c:\Inetpub\Sharp_Intranet\WordDocuments\followupletter.dot")
[b][COLOR=red]Set reppic = "C:\Inetpub\test.jpg"[/color][/b]
oWord.Options.PrintBackground = True
oDoc.Bookmarks("CustName").Range.Text = custname
oDoc.Bookmarks("CustA1").Range.Text = custa1
oDoc.Bookmarks("CustA2").Range.Text = custa2
oDoc.Bookmarks("CustNameSal").Range.Text = custnamesal
oDoc.Bookmarks("CustRep").Range.Text = repname
oDoc.Bookmarks("RepPhone").Range.Text = repphone
oDoc.Bookmarks("RepPhone2").Range.Text = repphone
[b][COLOR=red]oDoc.Bookmarks.Item("reppic").Range.InlineShapes.AddPicture = reppic[/color][/b]
oDoc.PrintOut
'oDoc.SaveAs "c:\test3.doc", wdSaveFormat
oDoc.Close 0
oWord.Quit
Set oDoc = nothing
Set oWord = nothing
End Function
The code that is in bold and red is what I have been playing around with. As you can see from the following, we have a link that when clicked, it will pull our Rep's name and phone number, as well as the customer name/address, etc. We would like it to also pull a pic depending on what rep it is. I am just not sure how to code that properly. Any help is appreciated. TIA!
Enkrypted
A+