Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Creating and using add-ins

I just finished writing some VBA code that will let me automatically refresh
the series of a chart (to account for more or less rows in the data set). I
want to use this code in several XLS spreadsheets, but only want to maintain
one copy.

I've saved this file as an XLA, added it to the list of add-ins for my
spreadsheet that has the charts I want to reformat. I then created a macro
that calls a function FormatChart( ) in the add-in. But when I run the
macro, I get a "sub of function not defined" error. It's as if the
application doesn't know to look at the add-in file for this function.

Any ideas?
--
Email address is not valid.
Please reply to newsgroup only.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Creating and using add-ins

You have a couple of options.

#1. Use application.run

dim myAddinName as string
myaddinname = "someaddinname.xla"
application.run "'" & myaddinname & "'!FormatChart"
'or to pass parms
Application.Run "'" & myaddinname & "'!FormatChart", A, B
'or to pass parms and return a value:

res = Application.Run("'" & myaddinname & "'!FormatChart", A, B)

#2. In the Calling workbook's project, you can set a reference to the addin.

First, rename the project's name (don't use the default--VBAProject). You'll
want it to be unique. Then save your addin with that new project name.

Then in the workbook doing the calling:
tools|references
and check that addin's project.

Now you can use those functions--just like they're built into excel's VBA.


Dale Fye wrote:

I just finished writing some VBA code that will let me automatically refresh
the series of a chart (to account for more or less rows in the data set). I
want to use this code in several XLS spreadsheets, but only want to maintain
one copy.

I've saved this file as an XLA, added it to the list of add-ins for my
spreadsheet that has the charts I want to reformat. I then created a macro
that calls a function FormatChart( ) in the add-in. But when I run the
macro, I get a "sub of function not defined" error. It's as if the
application doesn't know to look at the add-in file for this function.

Any ideas?
--
Email address is not valid.
Please reply to newsgroup only.


--

Dave Peterson
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
Creating IF with OR Joe Gieder Excel Worksheet Functions 3 April 19th 07 06:21 PM
creating a pdf Andrew R Excel Discussion (Misc queries) 4 September 19th 06 08:21 PM
Creating ActualSelf Excel Discussion (Misc queries) 1 October 20th 05 08:03 PM
Creating COM add-in Jens Thiel[_2_] Excel Programming 0 May 28th 04 06:30 PM
Creating an XLL with C# Jon Anderson Excel Programming 1 May 26th 04 09:02 AM


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