Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problems Loading Analysis ToolPak when automating from Visual Basic

Hi,

If someone could help me on this it would be appreciated greatly as it
has baffled me. I'm working on a project where I dynamically populate
Excel spreadsheets using Excel templates, Visual Basic and a SQL
Server Back-End. I'm currently having problems loading the Analysis
ToolPak Upon opening the the template from Visual Basic. The function
I am using is the WORKDAY() function.

When I open the template on Its own the workday function works and it
is added when I look in the addins manager. However as soon as I open
the template the the WORKDAY function does not work, returning #NAME.
If I go into the function builder the function is no longer there, and
when I go into the addins manager the analysis toolpak is checked.
Unchecking-Applying-Checking-Applying does not work. All of this
happens regardless of whether I have another excel session running or
not.

The only way I have found around it is if I save it and open the saved
file in a NEW excel session. If I close the saved file in the
Automated session and try to open it in the same session the error
remains, So I think it lies in an error in the automated session. I've
tried late and early binding but that doesn't seem to be the problem.
Can anyone help?

Thanks in advance
Mike.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Problems Loading Analysis ToolPak when automating from Visual Basic


It's not clear to me from your description exactly what you're doing,
but if you're starting Excel from Visual Basic using automation, none of the
add-ins load that you would normally expect to load if you started Excel
manually.

If you need one of these add-ins, like the Analysis Toolpak, you'll need
to load it in your VB code after you start Excel. The syntax looks like
this, assuming you have an object reference to your Excel Application object
in a variable named xlApp:

xlApp.Addins("Analysis ToolPak").Installed = True

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"wikamto" wrote in message
om...
Hi,

If someone could help me on this it would be appreciated greatly as it
has baffled me. I'm working on a project where I dynamically populate
Excel spreadsheets using Excel templates, Visual Basic and a SQL
Server Back-End. I'm currently having problems loading the Analysis
ToolPak Upon opening the the template from Visual Basic. The function
I am using is the WORKDAY() function.

When I open the template on Its own the workday function works and it
is added when I look in the addins manager. However as soon as I open
the template the the WORKDAY function does not work, returning #NAME.
If I go into the function builder the function is no longer there, and
when I go into the addins manager the analysis toolpak is checked.
Unchecking-Applying-Checking-Applying does not work. All of this
happens regardless of whether I have another excel session running or
not.

The only way I have found around it is if I save it and open the saved
file in a NEW excel session. If I close the saved file in the
Automated session and try to open it in the same session the error
remains, So I think it lies in an error in the automated session. I've
tried late and early binding but that doesn't seem to be the problem.
Can anyone help?

Thanks in advance
Mike.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problems Loading Analysis ToolPak when automating from Visual Basic

Thanks Rob, actually I did this about 20 Mins after I posted so I've
worked it out already. I also had to set the Analysis ToolPak to false
then true for it work. Excel still thinks that is added upon entry.

Also, why was this posted somewhere else other than google groups? I
can't reply to the the dev forums you ended up posting it too? why do
that for? I specifically posted to google and I would hope it would
stay that way in future posts.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problems Loading Analysis ToolPak when automating from Visual Basic

I am reading both your posts in a developer group. Why did you post in a
developer group if you did not want the answer here?

--
Regards,
Tom Ogilvy


wikamto wrote in message
om...
Thanks Rob, actually I did this about 20 Mins after I posted so I've
worked it out already. I also had to set the Analysis ToolPak to false
then true for it work. Excel still thinks that is added upon entry.

Also, why was this posted somewhere else other than google groups? I
can't reply to the the dev forums you ended up posting it too? why do
that for? I specifically posted to google and I would hope it would
stay that way in future posts.



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
Loading the Analysis ToolPak marcus Excel Discussion (Misc queries) 3 February 2nd 10 08:04 PM
problems with excel and visual basic for applications Edward Letendre Excel Discussion (Misc queries) 0 September 24th 09 11:03 PM
Excel 2002 Analysis ToolPak Regression Analysis Help Requested MH Excel Worksheet Functions 1 February 28th 09 07:16 AM
loading descriptive analysis toolpak-HELP myzkitti Excel Worksheet Functions 1 February 24th 09 10:01 PM
Loading a linked spreadsheet, Microsoft Visual Basic, error while. Wacher Excel Discussion (Misc queries) 0 April 18th 05 03:15 PM


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