Solved

Include non-Excel steps in an Excel macro

Posted on 2014-01-07
5
199 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to read BOM (Byte Order Mark) from csv file. 4 37
InStr Function not working properly in macro 3 19
ADD New Entries 7 16
Access Excel export not behaving 2 25
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now