If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel values passed to Outlook email

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-07, 10:19
acrumbacker acrumbacker is offline
Registered User
 
Join Date: Jan 2006
Posts: 31
Excel values passed to Outlook email

I am trying to have a script within Excel to open Outlook, then pass certain parameters (subject, sender, and text message) to a new email message. I have another macro called ccreated that copies a section of cells to the clipboard and I would like to have this pasted into the email message; the user verifies the email and then sends. Any help appreciated. My code is below:
**********************
Dim strExcelFile As String
Dim SV As String
Dim sub1 As String
Dim sub2 As String


' Get the file name to include in the subject
strExcelFile = ActiveWorkbook.Name

'strExcelFile = Dir(strPath & "\*.XLS")

SV = MsgBox("This is for OCO to return information to form submitter. Continue?", vbYesNo)
If SV = vbYes Then

Call ccreated ' this copies a defined section to the clipboard
sub1 = "Important: Contracts Created from eForm98 request: " & strExcelFile
sub2 = Range("submitter").Value 'this obtains an email address from a cell range

ActiveWorkbook.Save 'saves the worksheet

'Tried this below -- Works in ACCESS but error received from within Excel
'DoCmd.SendObject _
'To:=sub2, _
'Subject:=sub1, _
'MessageText:="Press SHIFT+Insert to paste message", _
'EditMessage:=True

'The below version sends the file as an attachment
'Application.Dialogs(xlDialogSendMail).Show _
arg1:=sub2, arg2:=sub1
End If
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On