ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003 (https://www.excelbanter.com/excel-programming/316160-excel-2003-a.html)

TOM

Excel 2003
 
Hello,

I used these two "scripts" in Offic Xp and works perfectly. Now I am using
Office 2003 and these scripts dosnt work, so can you help me?

First: If outlook dosnt run then run outlook (it allways opens)

On Error Resume Next
WhichProgram = GetObject(, "Outlook.Application")
If Err.Number < 0 Then IsItRunning = True
Err.Clear
If IsItRunning = True Then
Dim RetVal
RetVal = Shell("C:\Program Files\Microsoft
Office\Office11\Outlook.EXE", 6)
End If

Second: Send email from excel (Outlook just flash but nothing happens)

Dim objEnv As MsoEnvelope
ActiveSheet.Range("A1", "D30").Select
ThisWorkbook.EnvelopeVisible = True
Set objEnv = List1.MailEnvelope
With objEnv
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With


Thank you Tom



Juan Pablo González

Excel 2003
 
Use

CreateObject "Outlook.Application"

instead of the Shell command. Not sure if your install made into the same
path, which might be the cause of your problems.

--
Regards

Juan Pablo González

"TOM" wrote in message
...
Hello,

I used these two "scripts" in Offic Xp and works perfectly. Now I am using
Office 2003 and these scripts dosnt work, so can you help me?

First: If outlook dosnt run then run outlook (it allways opens)

On Error Resume Next
WhichProgram = GetObject(, "Outlook.Application")
If Err.Number < 0 Then IsItRunning = True
Err.Clear
If IsItRunning = True Then
Dim RetVal
RetVal = Shell("C:\Program Files\Microsoft
Office\Office11\Outlook.EXE", 6)
End If

Second: Send email from excel (Outlook just flash but nothing happens)

Dim objEnv As MsoEnvelope
ActiveSheet.Range("A1", "D30").Select
ThisWorkbook.EnvelopeVisible = True
Set objEnv = List1.MailEnvelope
With objEnv
.Item.To = "
.Item.Subject = "Test"
.Item.Send
End With


Thank you Tom






All times are GMT +1. The time now is 08:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com