PC Review


Reply
Thread Tools Rate Thread

Creating and using add-ins

 
 
=?Utf-8?B?RGFsZSBGeWU=?=
Guest
Posts: n/a
 
      15th Dec 2006
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.
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      15th Dec 2006
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with creating query or creating report Need Help Microsoft Access Database Table Design 0 29th Apr 2008 02:22 AM
Creating VBA Functions When Creating Spreadsheet Via VBA? PeteCresswell Microsoft Excel Programming 6 18th Jun 2007 12:38 PM
creating PDF from msword - I get error while creating bookmarks =?Utf-8?B?bWFyay1uZWVkcy1oZWxw?= Microsoft Word Document Management 1 1st Nov 2005 05:48 AM
Auto creating text fields when creating new slide. =?Utf-8?B?amFtZXM=?= Microsoft Powerpoint 1 16th Jun 2005 04:02 PM
Walkthrough: Creating a Dist. App. - problems creating project =?Utf-8?B?R2FyeURvdE5ldA==?= Microsoft Dot NET 1 12th Aug 2004 03:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:50 AM.