LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Run add-in code when Excel starts

once instantiated...
xl.visible = True

"RB Smissaert" wrote in message
...
Got Excel to start with this:

AddScheduleTask "5:00", _
"""C:\Program Files\Microsoft
Office\Office10\Excel.exe""", , , True, False

But started the Windows installer and popped up a dialog.
If I set RunInteractive = False it will run invisible and I don't want
that.

It doesn't seem this is a simple thing to do.


RBS


"Patrick Molloy" wrote in
message ...
its much easier if your scedul;er riuns a vb script program
very simple to do.

open notepad, add this example,

option explicit
dim passparam
dim xl as object
dim wb as object

Set xl = CreateObject("Excel.Application")

xl.workbooks.open "s:\Myworkbook.xls"


if wscript.arguments.count = 0 then
' no sub to call
else
passparam = Wscript.Arguments.Item(0)
select case passparam
case "A"
wb.run "MySub","A"
case "B"
wb.run "MySub","X"
Case else
wb.run "someothersub"
end select

end if

now save the text file with a VBS extension, eg MyExcelTest.VBS

VB Scripts are built as part of XP . example
put MSGBOX "hello world!" in notepade & save to your desktop sa HW.VBS
now double click the HW.VBS icon on the desktop...hey presto!

With the code sample, you could call this like:
MyExcelTest.VBS "A"

in which case the pass parameter is the letter A. the rest is self
evident I
think

HTH
Patrick Molloy
Microsoft Excel MVP








"RB Smissaert" wrote:

Using Excel 2000 to 2003.
I would like to run a Sub in an Excel add-in when Excel starts, but only
when
this is specified with a commandline parameter.
Excel will be started by the Windows Task Scheduler.
What I could do is add a workbook to the Scheduler commandline and put
some
code in this workbook that will run with the Open event. This is a bit
clumsy though
as I don't need the extra workbook.
Thanks for any advice.

RBS







 
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
Excel E-2007 starts, but Installer also starts 3 times??? Thanks for the Great Tip Setting up and Configuration of Excel 0 January 24th 10 03:21 AM
Excel starts very slowly THIBUS Trévis Excel Discussion (Misc queries) 0 November 19th 09 10:14 PM
Excel Starts When I hit te Zero Key [email protected] Excel Discussion (Misc queries) 0 October 7th 08 11:12 PM
excel starts incorrectly Arnold Excel Discussion (Misc queries) 0 September 16th 07 01:30 AM
Excel starts sorting from row 210 Why? Bob Excel Discussion (Misc queries) 1 October 21st 05 02:45 PM


All times are GMT +1. The time now is 07:43 PM.

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

About Us

"It's about Microsoft Excel"