|
Open Microsoft Outlook from Excel
This free macro will open the Microsoft Outlook program on your computer. You do need to have this program first. This will not open a specific email or attempt to send anything from excel or your computer; it simply opens the Microsoft Outlook program and nothing more. It can be attached to a button or checkbox or form and set to run when that item is clicked or this code can be input into an existing macro in excel.
Note:You must already have Microsoft Outlook on your computer for this macro to work.
Where to install the macro: Module
Open Microsoft Outlook from Excel
Sub Open_Outlook()
'This Macro Opens Microsoft Outlook
'
Shell ("OUTLOOK")
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
Today a company e-mailed me a quotation with the extension: xls
I don't have Excel and eventually found Excel Viewer 2003. This took 45 mins
to download, and then didn't work. The Excel File Graphic had appeared atop
the quotation file - but when clicked on Excel Viewer 2003 opened and just
said: cannot open this file type.
Any ideas? Would appreciate solution. Running XP SP2 on a Dimension 8250..
Thanks
Hello All:
I'm trying to write a macro that will send e-mails via outlook from an excel file. I'm not well versed in Outlook. Can someone offer any pointers and let me know if I'm on the right track?
Code:
Sub Mail_Selection_Range_Outlook_Body()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
On Error Resume Next
Set rng = Sheets("Sheet1").Range("B300:B900").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.Send 'or use .Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2010
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook
TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With
'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
FileName:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HTMLType:=xlHtmlStatic)
.Publish (True)
End With
'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
"align=left x:publishsource=")
'Close TempWB
TempWB.Close savechanges:=False
'Delete the htm file we used in this function
Kill TempFile
Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function
I have a list of 20 people in excel with their details as follows:
Column A: Last Name
Column B: First Name
Column C: email address
I need a macro code which when clicked selects all the email ids and pastes them in the 'TO' field in microsoft outlook to send out an email.
Thanks in advance.
you can use the sendkeys command to send a the hotkey y to outlook.
This has the same effect as when you click yes, only the macro does it
for you this time. You have to wait 5 seconds before using te sendkey
command in order for it to work (outlook waits 5 seconds before
enabling the yes button)
Hi,
Can anyone help with exporting email addresses in an Excel document into a contact group/distribution list in Microsoft Outlook? I've tried the Excel Help tutorial but it did not seem to work. I am going crazy - any help would be greatly appreciated!!
Thanks! I look forward to your responses.
-Megan
when i ask a question to the assistant i get a blank screen for the answer
can I run an excel macro when open outlook w/o workbook open or just not seeing the workbook be opened?
i already have a macro to send emails from excel based on a result of a single cell; i just don't see a point in also having to open the excel file, view the result in excel, then hit the macro button in excel just to send myself an email to outlook.
possible?
Other Microsoft Office application can be open normally, but when I open Microsoft Excel, nothing happen.
I'm using Microsoft Office 2007. Any idea how to open Excel 2007 program?Thanks
the my microsofrt excel does not open from the desktop. Everytime i try to
open excel 2003 it says"window installer;preparing to install." Then it
says"please wait while microsoft configures microsoft basic edition2003." it
says verify that file exist & that you can access it. but I can't. Thank you.
|
|