Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2008
    Posts
    2

    Unanswered: how to use excel function in acces?

    Hi friends,

    Friends i m trying to use excel function in access table. will u please tell me how to define excel function in access through coding.
    this queries i used but showing error-428;

    ---------------------------
    Public Function erlangB_traffic(Device As Double, block_prob As Double) As Double
    Dim obj As Object
    Set obj = CreateObject("Excel.Application")
    erlangB_traffic = obj.WorksheetFunction.erlangB_traffic(Device, block_prob)
    Set obj = Nothing
    End Function
    ---------------------------
    Here,
    erlangB_traffic - is my excel function.

    Please tell me, do i need to edit this coding.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Movification status:
    Completified.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    What line does it error on? What is the error text?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Apr 2008
    Posts
    2
    it is showing error in 4th line

    erlangB_traffic = obj.WorksheetFunction.erlangB_traffic(Device, block_prob)


    error:

    Run-time error '438':
    Object doesn't support this property or method.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I can't remember how I have called Excel functions in the past - I will have to dig up my code - but I am pretty sure it was not like that. I think (but am not sure) you can only access native, VBA functions using that method - not your own functions. Apart from anything else - wouldn't that function be part of a spreadsheet rather than accessible via the application object?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    If you've referred to Excel in your project, use:
    Code:
    Excel.Application.Worksheetfunctions.*FunctionNameGoesHere*(*FunctionArguementsGoHere*)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •