Call SeoTools functions from MS Access

Hi there!
I'd like to call SeoTools functions in my Microsoft Access database, because I don't use excel sheets for my SEO purposes.

There seems to be a possibility to call the fuctions directly from the XLL file - if you know the name:
stackoverflow.com/questions/375552/how-do-i-call-an-xll-addin-function-from-vba

I tried

Private Declare Function HttpStatus Lib "o:\datenbanken\seo\SEOToolsForExcel\SeoTools32.xll" (ByVal path As String) As String

but it gives error 453 (DLL function not found). If I inspect the XLL with a DLL viewer, it shows a lot of functions called f0, f1, f2... etc. but not with the names I use in Excel.

Did anybody do this yet? :smile:
Thanks!
Martin

Really? Nobody ever did this?

Solved it by myself:

Option Compare Database
Option Explicit

Type HTTP_STATUS
    statusCode As Integer
    statusString As String
End Type

Private Function httpStatus(url As String) As HTTP_STATUS

    Dim excel As New excel.Application
    Dim resultString As String
    Dim stringParts() As String
    Dim i As Integer

    excel.Visible = True
    excel.RegisterXLL "C:\Program Files (x86)\SeoTools for Excel\SeoTools32.xll"
    
    resultString = excel.Run("httpStatus", url)
    stringParts = Split(resultString, " ")
    With httpStatus
        .statusCode = CInt(stringParts(0))
        .statusString = ""
        For i = 1 To UBound(stringParts)
            .statusString = .statusString & stringParts(i)
        Next i
    End With
    
    excel.Quit

End Function

Private Sub test()
    Debug.Print httpStatus("http://www.google.de").statusCode
End Sub

--
www.illusion-factory.de

4 Likes