The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Excel with macro // PDF conversion in Workflow and manual

HI all,

I have a excel sheet with a small macro which is making an http request to get the distance between 2 towns and update it in the cell (=Distance("myDestination"))

When opening the file in read only mode, the cells are up to date.

When visualizing the excel file in M-Files, they are not (error #name)

When converting in PDF thanks to a workflow action, the PDF file as the same error.

When converting the excel from M-Files to PDF with the PDF conversion command, cells are up to date.

Do you know why and how to convert via workflow this file without any error?

Public Const DIST = "http://www.distance2villes.com/recherche?source="


Function Distance(dest As String) As Variant
Dim lg As Integer, i As Integer
Dim Url As String, Txt As String, S As String
Application.ScreenUpdating = False

With ActiveSheet

            Url = DIST & "Hirtzfelden" & "&destination=" & dest
            With CreateObject("WINHTTP.WinHTTPRequest.5.1")
                .Open "GET", Url, False
                .send
                Txt = .responseText
            End With
            If InStr(1, Txt, "distanciaRuta") > 0 Then
                Distance = Split(Split(Txt, "id=""distanciaRuta"">")(1), " km</strong>")(0)
            Else
               Distance = ""
            End If
End With
Application.ScreenUpdating = True
End Function