Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Running a macro from a desktop icon shortcut

Hello.

I have a macro written in my workbook. I want to run it
by clicking on an icon on my desktop without having to
open MS Excel. I know this can be done in MS Access.

Also, I used the Shell function to run an .exe with a '0'
argument so it will be hidden. Do I have to end it or
close it or will it do that by itself when the .exe
finishes running?

-Sofia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Running a macro from a desktop icon shortcut

Sofia,

Try writing a VB Script file containing the following:

Dim XL
Dim WB
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("C:\Book1.xls")
XL.Run "TestMacro"
WB.Close
XL.Quit
Set WB = Nothing
Set XL = Nothing

Put this script file on you desktop.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Sofia" wrote in message
...
Hello.

I have a macro written in my workbook. I want to run it
by clicking on an icon on my desktop without having to
open MS Excel. I know this can be done in MS Access.

Also, I used the Shell function to run an .exe with a '0'
argument so it will be hidden. Do I have to end it or
close it or will it do that by itself when the .exe
finishes running?

-Sofia



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Running a macro from a desktop icon shortcut



I tried your VB script and works wonderfully except for one detail.

Every time I run the script, after it is done, it pops up a 'File
Available for Use' window telling me that my excel file is available for
editing giving me the option to open it as 'read/write' or 'cancel'.
It's doing this everytime. Is there a way to shut this off? Other than
this, I've run the script multiple times and works just fine.

-Sofia

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I put an icon for Desktop in Quick Access? JanetLouiseTrenholm Excel Discussion (Misc queries) 1 September 17th 09 03:11 PM
Shortcut key not running macro properly Ted M H Excel Discussion (Misc queries) 5 October 1st 08 11:07 PM
Desktop File Icon Josh O. Setting up and Configuration of Excel 3 August 23rd 07 09:30 PM
dragging a file to the desktop icon Shaun101 Excel Discussion (Misc queries) 0 January 8th 07 04:38 PM
how can i put the excel icon on my desktop? petre Excel Discussion (Misc queries) 4 February 20th 05 05:29 PM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"