Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old August 30th 09, 12:54 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Aug 2006
Posts: 87
Default Create executable file to run excel macro

Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan

  #2   Report Post  
Old August 30th 09, 05:10 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Aug 2006
Posts: 87
Default Create executable file to run excel macro

Thanks Joel

But I did not get the example given by you. It is exe file and it opens new
workbook. How can I use this to open the workbook that I wish?

Regards,
prm

"Joel" wrote:

Make the macro an Workbook open macro or call your macro from a workbook open.

Next create a BAT file to open the workbook and run the Bat.

Here is a sample of the bat file

"C:\Program Files\Microsoft Office\Office10\excel.exe" c:\temp\book1.xls

"Pawan" wrote:

Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan

  #3   Report Post  
Old August 30th 09, 06:02 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 9,101
Default Create executable file to run excel macro

Book1.xls is the workbook that contains that macro you want to run. The Exe
file is Excel.exe (this is the file that starts excel). The command line I
gave your startup excel and opens the workbook book1.xls. You can change the
workbook name to any xls file you like.


"Pawan" wrote:

Thanks Joel

But I did not get the example given by you. It is exe file and it opens new
workbook. How can I use this to open the workbook that I wish?

Regards,
prm

"Joel" wrote:

Make the macro an Workbook open macro or call your macro from a workbook open.

Next create a BAT file to open the workbook and run the Bat.

Here is a sample of the bat file

"C:\Program Files\Microsoft Office\Office10\excel.exe" c:\temp\book1.xls

"Pawan" wrote:

Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan

  #4   Report Post  
Old August 30th 09, 09:51 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2009
Posts: 117
Default Create executable file to run excel macro

It would be possible to write an executable to launch your userform, even
easier to do so from a script file of some sort but I'm guessing that isn't
really what you want to do. Wouldn't it be simpler to just have the
userform come up when the workbook is first opened or to give your coworkers
a command button in the Workbook to launch the userform? Plus, using a
separate executable file means you not only have to distribute your workbook
but the exe file as well plus deal with any security concerns over exe files
that your employer might have.


Steve Yandl



"Pawan" wrote in message
...
Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run
the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan


  #5   Report Post  
Old August 30th 09, 10:56 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 7,247
Default Create executable file to run excel macro

I would use a VBScript rather than an exe file. Open Notepad, and
enter the following in the text file:

Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "C:\A.xls"
XL.Run "A.xls!TheMacro"


Change "C:\A.xls" to the appropriate file name. Change
"A.xls!!TheMacro" to the workbook name and macro name.

Save the file as a vbs file, e.g., RunIt.vbs rather than a txt file.

Then, all the user needs to do is double click the vbs file and Excel
will start, open C:\A.xls and execute TheMacro.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Sun, 30 Aug 2009 04:54:01 -0700, Pawan
wrote:

Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan



  #6   Report Post  
Old July 10th 19, 04:10 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2019
Posts: 1
Default Create executable file to run excel macro

On Monday, August 31, 2009 at 3:26:16 AM UTC+5:30, Chip Pearson wrote:
I would use a VBScript rather than an exe file. Open Notepad, and
enter the following in the text file:

Set XL=CreateObject("Excel.Application")
XL.Visible=True
XL.Workbooks.Open "C:\A.xls"
XL.Run "A.xls!TheMacro"


Change "C:\A.xls" to the appropriate file name. Change
"A.xls!!TheMacro" to the workbook name and macro name.

Save the file as a vbs file, e.g., RunIt.vbs rather than a txt file.

Then, all the user needs to do is double click the vbs file and Excel
will start, open C:\A.xls and execute TheMacro.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Sun, 30 Aug 2009 04:54:01 -0700, Pawan
wrote:

Hi

I have written a complex macro in excel and now have to distribute it to
co-workers. However, I want to create an executable file which will run the
macro directly (will open the userform in my macro).

Is there any chance of doing so?

Thanks in advance

Regards,
Pawan


Thanks a lot Chip for this solution, however if i want to run a macro using using this and also want to pass parameters, how can i do that?


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
Create executable file to run excel macro Joel Excel Programming 0 August 30th 09 02:56 PM
getting an excel file to run as an executable excellenze Excel Discussion (Misc queries) 1 March 24th 06 07:45 PM
How do I create an executable excel file? StephenAccountant Excel Programming 6 February 21st 06 03:48 AM
Excel file as an executable? James Excel Programming 4 September 7th 05 08:51 PM
Is there a way to make Excel file an executable? luvgreen[_3_] Excel Programming 1 March 3rd 04 07:27 PM


All times are GMT +1. The time now is 11:31 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017