[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Use Excel Worksheet Function COUPPCD and COUPNCD

Posted on 2005-04-06
5
Medium Priority
?
995 Views
Last Modified: 2012-05-05
I want use Excel worksheet functions COUPPCD and COUPNCD in my VBA code for Access. I have created the Excel object and use its "worksheetfunction" method to call COUPPCD and COUPNCD. But it fails. Can someone help me to solve the problem? Or if there is equivalent functions in VBA or Access?
0
Comment
Question by:StanleyLMW
  • 3
  • 2
5 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 13724258
Hi,
Make sure you have a reference to the atpvbaen.xla something like this:

 Set XlsObj = New Excel.Application
   XlsObj.Workbooks.Open (XlsObj.Application.librarypath & _
       "\Analysis\atpvbaen.xla")
     
      ' Runs the AutoOpen macro in the add-in
  XlsObj.Workbooks("atpvbaen.xla").RunAutoMacros (1)


Good Luck!

Gary
0
 

Author Comment

by:StanleyLMW
ID: 13724753
THX
After using the code you have provided, it still doesn't work. VBA reports that the object (which is Excel object) does not support the method COUPPCD or COUPNCD
0
 
LVL 46

Accepted Solution

by:
tbsgadi earned 2000 total points
ID: 13724855
In your function after the above code try something like

MyFunc  = XlsObj.Application.Run("atpvbaen.xla!COUPPCD ", Param1, Param2,Param3,Param4)

Makesure that the params are of the right data type
0
 

Author Comment

by:StanleyLMW
ID: 13725356
great it is done
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 13726496
Glad to help!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question