#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default E-Mailing

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default E-Mailing

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default E-Mailing

Compile Error: Invalid outside procedure.

"FSt1" wrote:

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default E-Mailing

You have something outside the "Sub/End Sub" statements or "Function/End
Function" statements.

But it's difficult to see from here <bg.

Norm wrote:

Compile Error: Invalid outside procedure.

"FSt1" wrote:

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default E-Mailing

And

send an email out to a distribution list


See
http://www.rondebruin.nl/mail/tips2.htm


Or Send to Outlook Distribution Group
Instead of .To " use

.Recipients.Add "GroupName"





--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dave Peterson" wrote in message ...
You have something outside the "Sub/End Sub" statements or "Function/End
Function" statements.

But it's difficult to see from here <bg.

Norm wrote:

Compile Error: Invalid outside procedure.

"FSt1" wrote:

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)



--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default E-Mailing

Here you are Dave, please let me know what I'm doing wrong.

Sub Mail_Workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "sdpg"
.CC = ""
.BCC = ""
.Subject = "7 Day Work Plan"
.Body = "Good Morning"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("T:\D32SHR\ETDweb\DCOM\DCOM 7 DAY PLAN ALL
SERVICE CENTER\Master Sheets\2007\All Service Centers Master 5_7.xls")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



"Dave Peterson" wrote:

You have something outside the "Sub/End Sub" statements or "Function/End
Function" statements.

But it's difficult to see from here <bg.

Norm wrote:

Compile Error: Invalid outside procedure.

"FSt1" wrote:

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)



--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default E-Mailing

You have something (unseen??) either before this code or after it.

Be very careful and copy just the stuff between the Sub/End Sub into a new
module.

Then delete the old module and test it out.

Norm wrote:

Here you are Dave, please let me know what I'm doing wrong.

Sub Mail_Workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "sdpg"
.CC = ""
.BCC = ""
.Subject = "7 Day Work Plan"
.Body = "Good Morning"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("T:\D32SHR\ETDweb\DCOM\DCOM 7 DAY PLAN ALL
SERVICE CENTER\Master Sheets\2007\All Service Centers Master 5_7.xls")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

"Dave Peterson" wrote:

You have something outside the "Sub/End Sub" statements or "Function/End
Function" statements.

But it's difficult to see from here <bg.

Norm wrote:

Compile Error: Invalid outside procedure.

"FSt1" wrote:

what is the message?

"Norm" wrote:

Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:

Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub


I get the following msg below when running it:

Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)



--

Dave Peterson


--

Dave Peterson
Reply
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
I need to import my Excel Mailing list into mailing label format. Gord Dibben Excel Discussion (Misc queries) 0 November 5th 09 10:16 PM
I need to import my Excel Mailing list into mailing label format. Lyn Excel Discussion (Misc queries) 0 November 5th 09 08:11 PM
E-mailing CV323 Excel Programming 1 May 29th 07 04:55 PM
mailing ceemo[_45_] Excel Programming 0 November 2nd 05 08:06 AM
how do i convert MS Word mailing labels into an Excel mailing lis. unrhyll Excel Discussion (Misc queries) 1 February 4th 05 12:19 AM


All times are GMT +1. The time now is 12:51 PM.

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"