LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Emailing workbook from Excel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving / emailing sinlge excel sheet, not entire workbook BRCorprado Excel Discussion (Misc queries) 2 September 17th 09 10:34 PM
Emailing an Excel Workbook with Links Frank G Links and Linking in Excel 2 June 29th 07 03:54 PM
Emailing an Excel Workbook with Links Frank G Excel Discussion (Misc queries) 0 April 11th 07 07:46 PM
emailing a workbook from within excel Damien Excel Programming 3 August 2nd 06 01:54 PM
Emailing a workbook Jmmac04 Excel Discussion (Misc queries) 0 November 22nd 05 05:20 PM


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"