|
-
May 8th, 2002, 06:25 PM
#1
Thread Starter
Junior Member
VBA Question
I am writing a vba program that will send an a excell spread sheet to different distribution lists deponding on what a user fills out in the spread sheet. The problem I am running into is that everyone has different versions of excell and outlook. Does anyone know how to load the proper library to support all these different versions.
thanks for your help!
Private Sub cmdSendMail_Click()
strver= Application.Version
'get version and how do I load the correct library deponding on version
'Save work book
' ActiveWorkbook.SaveAs "C:\ FormExcelVersion.xls"
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Dim strMail, MailLen
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
If Sheet1.chkone.Value = True Then
strMail = strMail + "emailaddresss" & ";"
End If
If Sheet1.chkTrack.Value = True Then
strMail = strMail + "emailaddresss" & ";"
End If
If Sheet1.chkEditor.Value = True Then
strMail = strMail + "emailaddresss" & ";"
End If
MailLen = Len(strMail) - 1
MsgBox Left(strMail, MailLen)
strMail = Left(strMail, MailLen)
With objMail
.to = strMail
.Subject = "test sheet " & Range("C15")
.Body = "This is an automated message from Excel. " & _
"Body: " & _
Format(Range("A14").Value, "$ #,###.#0") & "."
.Display
End With
' objMail.Attachments.Add("C:\FormExcelVersion.xls").DisplayName = "Start UP Form"
'objMail.Send
Set objMail = Nothing
Set objOL = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|