Link to home
Start Free TrialLog in
Avatar of Stanley Lai
Stanley LaiFlag for Hong Kong

asked on

Use Excel Worksheet Function COUPPCD and COUPNCD

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?
Avatar of tbsgadi
tbsgadi
Flag of Israel image

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
Avatar of Stanley Lai

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of tbsgadi
tbsgadi
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great it is done
Glad to help!