Solved

Include non-Excel steps in an Excel macro

Posted on 2014-01-07
5
206 Views
Last Modified: 2014-01-09
Hello,

Is there any way to include non-Excel steps in an Excel macro?

For example, suppose you want to be able to click (cell G7 say) in a certain worksheet, and by doing so, have it open a blank notepad. Or suppose, by clicking cell G8, you would like to be able to open a new email window in MS Outlook.

Is that doable?

Thanks
0
Comment
Question by:Steve_Brady
  • 2
  • 2
5 Comments
 
LVL 14

Assisted Solution

by:Farzad Akbarnejad
Farzad Akbarnejad earned 125 total points
ID: 39764249
Hi,
See the attached workbook. It contains VBA code in Sheet1 code page
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target = Range("G7") Then
        Shell "Notepad"
    ElseIf Target = Range("G8") Then
        Shell "outlook.exe /c ipm.note /m someone@somewhere.foo"
    End If
End Sub

Open in new window

-FA
Book1.xlsm
0
 
LVL 81

Accepted Solution

by:
byundt earned 375 total points
ID: 39764256
You can launch other applications from an Excel macro. One way is to create an object pointing to the other application. This may be done using early-binding (requires setting a reference to a particular version of the other application) or late-binding (runs slower, but doesn't generate an error message if the user has a different version of the application than you do). I use early-binding during program development because it exposes the object model for the other application, but then switch to late-binding before delivering the project to avoid the run-time error messages.

The other way is to use Shell to launch the application (as FarzadA has done). Use this approach if creating an object pointing to the other application doesn't work (such as for MS Paint).

Details of exactly how to do it will depend on the application you need to run, and whether it might already be running.
0
 
LVL 81

Assisted Solution

by:byundt
byundt earned 375 total points
ID: 39764278
Further to the discussion on late-binding for Outlook, Microsoft Excel MVP Ron deBruin offers an enormous amount of code for automating Outlook from Excel. Here is a typical page, where he shows how to send a small email message using an Excel macro and late-binding. http://www.rondebruin.nl/win/s1/outlook/bmail4.htm
0
 

Author Closing Comment

by:Steve_Brady
ID: 39769713
Thanks for the responses. I appreciate the input and the links.
0
 

Author Comment

by:Steve_Brady
ID: 39769750
This thread has given rise to a couple of other questions having to do with Excel macros producing global output. Rather than add that on to this thread, I opted to begin a new one which I will post shortly.

Thanks again
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I get SLA using Excel Raw Data 12 32
Excel IF  /  OR   statement 3 16
Excel lookup tables & values 7 24
Creating An Intelligent Dropdown 8 24
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question