Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Script to start Excel and load the add-ins

Hi, I have the following script to start Excel if it is not started and to
use an existing instance if it is:

Dim XL
Dim agrs
on error resume next
set XL = GetObject(,"Excel.Application")
If XL is Nothing Then Set XL = CreateObject("Excel.Application")
Set args = WScript.Arguments
XL.Workbooks.Open args(0)
XL.Visible = True

The problem is that if Excel is not started and this starts a new instance,
my add-ins (that are checked) do not load.

How to solve this?

Many thanks in advance,

Aaron Fude


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Script to start Excel and load the add-ins


This should do..

Sub LoadXLwithAddins()
Dim xl As Object
Dim ai As Object

Set xl = CreateObject("Excel.Application")

For Each ai In Application.AddIns
If ai.Installed Then
xl.Workbooks.Open(ai.FullName).RunAutoMacros 1
End If
Next

xl.Visible = True
Set xl = Nothing
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Aaron Fude" wrote:

Hi, I have the following script to start Excel if it is not started
and to use an existing instance if it is:

Dim XL
Dim agrs
on error resume next
set XL = GetObject(,"Excel.Application")
If XL is Nothing Then Set XL = CreateObject("Excel.Application")
Set args = WScript.Arguments
XL.Workbooks.Open args(0)
XL.Visible = True

The problem is that if Excel is not started and this starts a new
instance, my add-ins (that are checked) do not load.

How to solve this?

Many thanks in advance,

Aaron Fude




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Script to start Excel and load the add-ins

Hi keepITcool!

Thank you so much for your response. I don't mean to be a brat, but would
you mind combining the two scripts for me. If I do it, I'll mess up
something.

Keeping IT cool,

Aaron

"keepITcool" wrote in message
...

This should do..

Sub LoadXLwithAddins()
Dim xl As Object
Dim ai As Object

Set xl = CreateObject("Excel.Application")

For Each ai In Application.AddIns
If ai.Installed Then
xl.Workbooks.Open(ai.FullName).RunAutoMacros 1
End If
Next

xl.Visible = True
Set xl = Nothing
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Aaron Fude" wrote:

Hi, I have the following script to start Excel if it is not started
and to use an existing instance if it is:

Dim XL
Dim agrs
on error resume next
set XL = GetObject(,"Excel.Application")
If XL is Nothing Then Set XL = CreateObject("Excel.Application")
Set args = WScript.Arguments
XL.Workbooks.Open args(0)
XL.Visible = True

The problem is that if Excel is not started and this starts a new
instance, my add-ins (that are checked) do not load.

How to solve this?

Many thanks in advance,

Aaron Fude






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Script to start Excel and load the add-ins

This?


On Error Resume Next

Set xl = GetObject(, "Excel.Application")

If xl Is Nothing Then
Set xl = CreateObject("Excel.Application")

For Each ai In xl.AddIns
If ai.Installed Then
xl.Workbooks.Open(ai.FullName).RunAutoMacros 1
End If
Next
End If

xl.Workbooks.Open WScript.Arguments(0)
xl.Visible = True


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Aaron Fude" wrote:

Thank you so much for your response. I don't mean to be a brat, but

would
you mind combining the two scripts for me. If I do it, I'll mess up
something.


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
is it possable to run an macro or script at start up as you could Stan Halls Excel Worksheet Functions 2 June 14th 06 07:57 PM
Load Macro at start up? No Name Excel Programming 1 October 28th 03 07:27 PM
Load Macro at start up? MJ Antoszkiw Excel Programming 0 October 21st 03 04:11 PM
Load Macro at start up? Tom Ogilvy Excel Programming 0 October 21st 03 03:49 PM
Load Macro at start up? Frank Isaacs Excel Programming 0 October 21st 03 03:47 PM


All times are GMT +1. The time now is 01:34 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"