Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to use the following macro from Rondebruin's site, but am encountering an error at "wb.SaveCopyAs "C:/" & WBname". Any ideas? Also, is there a simpler way to get the email to open through Outlook, rather than putting in server details (see below)? The purpose of this macro is to open an email from Excel and Word and attach the open document. Thank you for your assistance Georgie Sub CDO_Send_Workbook() Dim iMsg As Object Dim iConf As Object Dim wb As Workbook Dim WBname As String ' Dim Flds As Variant Application.ScreenUpdating = False Set wb = ActiveWorkbook WBname = wb.Name & " " & Format(Now, "dd-mm-yy h-mm-ss") & ".xls" wb.SaveCopyAs "C:/" & WBname Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") ' iConf.Load -1 ' CDO Source Defaults ' Set Flds = iConf.Fields ' With Flds ' ..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' ..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here" ' ..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ' .Update ' End With With iMsg Set .Configuration = iConf .Subject = "This is a test" .TextBody = "This is the body text" .AddAttachment "C:/" & WBname End With Set iMsg = Nothing Set iConf = Nothing Set wb = Nothing Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving / emailing sinlge excel sheet, not entire workbook | Excel Discussion (Misc queries) | |||
Emailing an Excel Workbook with Links | Links and Linking in Excel | |||
Emailing an Excel Workbook with Links | Excel Discussion (Misc queries) | |||
emailing a workbook from within excel | Excel Programming | |||
Emailing a workbook | Excel Discussion (Misc queries) |