Download xml on mac

tibtill

New Member
Joined
Feb 5, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi, I use the code below to download an xml-file to a local folder and then I read it and use data...
The issue is that I cannot use the code on MACs, since the needed references are missing...

Pls. advise!

Thank you.


-------------------------
VBA Module:
-------------------------

Option Explicit
Option Private Module


'a reference to Microsoft XML 6.0 is mandatory


Public Sub GetFxFile(yr As Integer)

'define local variables and objects
Dim reader As New XMLHTTP60
Dim doc As DOMDocument60

'initialize the reader
reader.Open "GET", "Eroare/ Error" & Format(yr, "#") & ".xml", False
reader.setRequestHeader "Accept", "application/xml"
reader.send

Do Until reader.ReadyState = 4
DoEvents

Loop

'initialize the current workbook's path..
xPath = ThisWorkbook.Path

'check for reader's status
If reader.Status = 200 Then
Set doc = reader.responseXML

'save the xml file
If Application.OperatingSystem Like "Windows*" Then
doc.Save xPath & "\CursBNR.xml"
Else
doc.Save xPath & "/CursBNR.xml"
End If

Else
'inform the user
MsgBox "Missing file for target year...", vbOKOnly + vbExclamation + vbSystemModal, pName

'update data reference
dataRef = False

End If

End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,523
Messages
6,125,315
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top