• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Type mismatch with external excel function

Ola,

Using this code in my access 97 module and a reference to the excel objects library I can use excel functions from excell add in from within my access 97 VBA code.

Public Sub DoIt2()
    MsgBox fXLYield("2/15/2008", "11/15/2016", 557, 95.04287, 100, 2, 1)
End Sub
Public Function fXLYield(dtmSettlement As Date, dtmMaturity As Date, dblRate As Double, dblPR As Double, dblRedemption As Double, bytFrequency As Byte, bytBasis As Byte) As Double
    Dim objXL As Object
    Set objXL = CreateObject("Excel.Application")
    objXL.Workbooks.Open (objXL.Application.LibraryPath & "\Analysis\atpvbaen.xla")
    objXL.Workbooks("atpvbaen.xla").RunAutoMacros (xlAutoOpen)
    fXLYield = objXL.Application.Run("atpvbaen.xla!yield", dtmSettlement, dtmMaturity, dblRate, dblPR, dblRedemption, bytFrequency, bytBasis)
End Function

Now other functions work fine except for the Yield function that keeps telling me that the types mismatch.

Whats going on here?
0
DaFou
Asked:
DaFou
1 Solution
 
Gustav BrockCIOCommented:
At least dtmSettlement, dtmMaturity must be strings formatted to local date format.

/gustav
0
 
DaFouAuthor Commented:
hehe good for you :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now