I am trying to import a table from the following link into my database:
http://www.abif.cl/tasas.php?tipo=5
I am trying to do this by loading the page as an HTML file into a directory through VBA, and then creating a linked table.
This works great when I download it manually via Chrome using the “Download Full Web Page” option in the “Save As” section.
However, when I load a webpage using VBA, I get a Reserved Error (-5016) when I try to link a table.
Explanation: An error occurred while trying to load the page in HTML; rather, this happens after I try to link the table with the loaded HTML (it does not occur if the HTML was loaded manually through a browser)
Here is the VBA that I use to load HTML:
Option Compare Database
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) _
As Long
Public Function DownloadFile( _
ByVal strURL As String, _
ByVal strLocalFilename As String) _
As Long
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, strURL & vbNullChar, strLocalFilename & vbNullChar, 0, 0)
DownloadFile = lngRetVal
End Function
, , - , !
, " -" VBA?
!