ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modifying an Excel 2000 Macro (https://www.excelbanter.com/excel-programming/374387-modifying-excel-2000-macro.html)

LPS

Modifying an Excel 2000 Macro
 
Using Excel 2000, I have this macro, listed below, which creates a new blank
e-mail message. I would like to modify it so that when the macro executes
and the new e-mail is created an e-mail address automatically is entered in
the To: field.


Sub Send_Form()
'
' Send_Form Macro
' Macro recorded 20/03/2006 by LPS. Used to send form as an E-Mail attachment
'

'
Application.Dialogs(xlDialogSendMail).Show

End Sub


Thank you for any and all help.
--
LPS

galimi

Modifying an Excel 2000 Macro
 
If you set a reference to the Outlook Object model, you can populate all the
fields in your mail message:

Sub test()

Dim ol As Outlook.Application
Set ol = New Outlook.Application

Set oMessage = ol.CreateItem(olMailItem)
oMessage.Display
oMessage.To = "

End Sub



--
http://HelpExcel.com

516-984-0252


"LPS" wrote:

Using Excel 2000, I have this macro, listed below, which creates a new blank
e-mail message. I would like to modify it so that when the macro executes
and the new e-mail is created an e-mail address automatically is entered in
the To: field.


Sub Send_Form()
'
' Send_Form Macro
' Macro recorded 20/03/2006 by LPS. Used to send form as an E-Mail attachment
'

'
Application.Dialogs(xlDialogSendMail).Show

End Sub


Thank you for any and all help.
--
LPS


LPS

Modifying an Excel 2000 Macro
 
Thank you for your suggestion. I copied and pasted the code into my macro
and tried it and got the following error:

Compile Error:

User-defined type not defined.

I know very little about macros so if I needed to edit your code, I would
not know what edits to make. Suggestions???

Again, thanks for your help
--
LPS


"galimi" wrote:

If you set a reference to the Outlook Object model, you can populate all the
fields in your mail message:

Sub test()

Dim ol As Outlook.Application
Set ol = New Outlook.Application

Set oMessage = ol.CreateItem(olMailItem)
oMessage.Display
oMessage.To = "

End Sub



--
http://HelpExcel.com

516-984-0252


"LPS" wrote:

Using Excel 2000, I have this macro, listed below, which creates a new blank
e-mail message. I would like to modify it so that when the macro executes
and the new e-mail is created an e-mail address automatically is entered in
the To: field.


Sub Send_Form()
'
' Send_Form Macro
' Macro recorded 20/03/2006 by LPS. Used to send form as an E-Mail attachment
'

'
Application.Dialogs(xlDialogSendMail).Show

End Sub


Thank you for any and all help.
--
LPS


Sandy

Modifying an Excel 2000 Macro
 
Look in the help section of the VBE and look for Built-In Dialog Box
Argument Lists under xlDialogSendMail you will see some arguments to
the right you can use for Subject, Recipient, and return receipt.
Heres an example:

Application.Dialogs(xlDialogSendMail).Show arg1:="Recipients Name",
arg2:="My Subject"

Good luck,

Sandy


LPS wrote:
Using Excel 2000, I have this macro, listed below, which creates a new blank
e-mail message. I would like to modify it so that when the macro executes
and the new e-mail is created an e-mail address automatically is entered in
the To: field.


Sub Send_Form()
'
' Send_Form Macro
' Macro recorded 20/03/2006 by LPS. Used to send form as an E-Mail attachment
'

'
Application.Dialogs(xlDialogSendMail).Show

End Sub


Thank you for any and all help.
--
LPS



LPS

Modifying an Excel 2000 Macro
 
Thank you Sandy. That helped tremendously. Great tip.
--
LPS


"Sandy" wrote:

Look in the help section of the VBE and look for Built-In Dialog Box
Argument Lists under xlDialogSendMail you will see some arguments to
the right you can use for Subject, Recipient, and return receipt.
Heres an example:

Application.Dialogs(xlDialogSendMail).Show arg1:="Recipients Name",
arg2:="My Subject"

Good luck,

Sandy


LPS wrote:
Using Excel 2000, I have this macro, listed below, which creates a new blank
e-mail message. I would like to modify it so that when the macro executes
and the new e-mail is created an e-mail address automatically is entered in
the To: field.


Sub Send_Form()
'
' Send_Form Macro
' Macro recorded 20/03/2006 by LPS. Used to send form as an E-Mail attachment
'

'
Application.Dialogs(xlDialogSendMail).Show

End Sub


Thank you for any and all help.
--
LPS





All times are GMT +1. The time now is 09:28 PM.

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