stl-it
asked on
VBS Script that inserts a url rather than an image
I created a vb script that pulled information from Active Directory and created an Outlook signature with the information. It works perfectly and took me quite a while to get it to this point. The only issue that I'm running into is that the script is inserting the image into the email, rather than a pointer, so the image gets sent as an attachment. I want the vb script to insert html code instead of inserting the image. To clarify, I then want Outlook to send the link to the recipient instead of the image itself. I've tried several different ways and haven't been able to get it to work.
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strFName = objUser.FirstName
strLName = objUser.LastName
strInfo = objUser.info
strMobile = objUser.Mobile
strWebAddress = "www.companyinc.com"
Logo = "http://www.companyinc.com/pages/images/pages/companylogo.jpg"
strDepartment = objUser.Department
strAddress = objUser.StreetAddress
strCity = objUser.l
strState = objUser.St
strPostalCode = objUser.PostalCode
strPhone = objUser.telephoneNumber
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Name = "Verdana"
objSelection.Font.Color = "000,000,000"
objSelection.Font.Italic = false
objSelection.Font.Bold = true
objSelection.Font.Size = "10"
objSelection.TypeText strFName
objSelection.TypeText " " & strLName
objSelection.TypeText "" & strInfo
objSelection.TypeParagraph()
objSelection.Font.Name = "Verdana"
objSelection.Font.Color = "000,000,000"
objSelection.Font.Italic = false
objSelection.Font.Bold = false
objSelection.Font.Size = "9"
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Hyperlinks.Add strWebAddress
objSelection.InlineShapes.AddPicture(Logo)
objSelection.TypeParagraph()
objSelection.TypeText strAddress
objSelection.TypeText " | "
objSelection.TypeText strCity
objSelection.TypeText ", " & strState
objSelection.TypeText " " & strPostalcode
objSelection.TypeParagraph()
objSelection.TypeText strPhone
objSelection.TypeText " (Office) | " &strMobile
objSelection.TypeText " (Cell)"
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.TypeText "Visit us on the web @ "
Set hyp = objSelection.Hyperlinks.Add(objSelection.Range, strWebAddress, "", "", strWebAddress)
hyp.Range.Font.Size = "9"
hyp.Range.Font.Name = "Verdana"
Set objSelection = objDoc.Range()
objSignatureEntries.Add "company Signature", objSelection
objSignatureObject.NewMessageSignature = "company Signature"
objSignatureObject.ReplyMessageSignature = ""
objDoc.Saved = True
objWord.Quit
If you want the link to say something other than the full URL use the following.
Set hyp1 = objSelection.Hyperlinks.Add(objSelection.Range, Logo, , , "Our Company Logo")
ASKER
I think that just makes the hyperlink appear rather than the image. I think what I'm after is an embedded image rather than an image that is embedded and sent as an attachment. Hope that makes some sort of sense.
Sorry I understood you wanted to send as a URL...what client are you using? Outlook as your code works.
It might be a setting in Outlook you are looking for. In Tools..Options...Mail Format Tab. Click the Internet Format button as see if "When an HTML message contains pictures located on the Internet send a copy not the location" is checked.
If I uncheck mine it sends it as an attachment.
It might be a setting in Outlook you are looking for. In Tools..Options...Mail Format Tab. Click the Internet Format button as see if "When an HTML message contains pictures located on the Internet send a copy not the location" is checked.
If I uncheck mine it sends it as an attachment.
ASKER
Outlook 2003 and Outlook 2007
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is this what you were looking for?
Open in new window