I am currently trying to make work some of codes, which work fine in standart excel.
According to instruction: 12.17 Why is ThisWorkbook.Path not working? I apply this code:
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
PathToFile = XLSPadlock.PLEvalVar("EXEPath") & Filename
Exit Function
Err:
PathToFile = ""
End Function
My code is:
Dim strFileName As String
Dim strFileTitle As String
strFileTitle = “PriceList.xlsb”
strFileName = PathToFile
If Dir(strFileName) = vbNullString Then
MsgBox “No Price List found’”
Another code is:
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject(“Microsoft.XMLHTTP”)
WinHttpReq.Open “GET”, myURL, False, “Username”, “Password”
WinHttpReq.send
If WinHttpReq.STATUS = 200 Then
Set oStream = CreateObject(“ADODB.Stream”)
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile (PathToFile(“PriceList.xlsb”)), 2
oStream.Close
End If
Can anybody adivice how correctly apply PathToFile for above codes?