Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default AddIn functions in code?

Can I use functions from addIns in VBA code? I have custom functions as well
as some from Excel's addIns that I would like to use in a module. Is this
possible? (Also I am new to programming and I am trying to learn VBA from
the few examples in John Walkenbach's Excel 2003 Bible. Would his Excel VBA
book be a good start?)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default AddIn functions in code?

One way is to add a reference to that addin to your workbook's project.

Make sure that the project name isn't VBAProject--make it a nice unique name.
Select your addin's project in the VBE, hit F4 to see the properties window and
change the (name) property.

Then select your workbook's project that will use that addin and
tools|references
and check that addin's project.

Then you can use your functions just like they're built into VBA.

You could also use something like:

dim res as variant
res = Application.Run("youraddinname.xla!yourfunction", parm1, parm2, parm3)

With no references.

Rbp9ad wrote:

Can I use functions from addIns in VBA code? I have custom functions as well
as some from Excel's addIns that I would like to use in a module. Is this
possible? (Also I am new to programming and I am trying to learn VBA from
the few examples in John Walkenbach's Excel 2003 Bible. Would his Excel VBA
book be a good start?)


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default AddIn functions in code?

Yes it's a great book.

yes you can use functions in code
helpWorksheetfunction. see list of supported functions and note that
WorksheetFunction.functionname(stuffhere) is the typical syntax

Syntax is the hardest component of coding.

"Rbp9ad" wrote:

Can I use functions from addIns in VBA code? I have custom functions as well
as some from Excel's addIns that I would like to use in a module. Is this
possible? (Also I am new to programming and I am trying to learn VBA from
the few examples in John Walkenbach's Excel 2003 Bible. Would his Excel VBA
book be a good start?)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default AddIn functions in code?

I wrote the function to return a vendor number from an account number.

Option Explicit
Function Vendor(VR As Variant) As String

Application.Volatile True


Dim Acct As Variant


Acct = Strings.Left(RRLookup(VR, 11), 12)

Select Case Acct
Case Is = "236SPDTI DTI", "207SPDI3 DI3", "207SPDTI DTI"
Vendor = "36359"
Case Is = "202SPDTI DTI"
Vendor = "2810"
Case Is = "240SPLIG LIG"
Vendor = "2814"
Case Else
Vendor = ""
End Select
End Function
The account number is looked up from a spreadsheet that is entered manually.
I was wondering if there was a way to make the function less sensitive to
typos and differing input (Additional spaces etc.).
"Vacation's Over" wrote in message
...
Yes it's a great book.

yes you can use functions in code
helpWorksheetfunction. see list of supported functions and note that
WorksheetFunction.functionname(stuffhere) is the typical syntax

Syntax is the hardest component of coding.

"Rbp9ad" wrote:

Can I use functions from addIns in VBA code? I have custom functions as
well
as some from Excel's addIns that I would like to use in a module. Is this
possible? (Also I am new to programming and I am trying to learn VBA from
the few examples in John Walkenbach's Excel 2003 Bible. Would his Excel
VBA
book be a good start?)





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
Collection custom functions as asn addin FARAZ QURESHI Excel Discussion (Misc queries) 2 December 29th 07 09:17 PM
Custom Functions saved as addin dbutcher Excel Worksheet Functions 2 April 7th 06 05:24 PM
Addin loads but functions don't work KitenutDave Excel Programming 5 August 4th 05 08:20 PM
addIn functions in automation nicgendron Excel Programming 1 July 14th 05 10:35 AM
Using Functions from an Excel Addin MWGreen Excel Programming 1 January 22nd 04 09:31 PM


All times are GMT +1. The time now is 04:40 AM.

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"