我是将VBA与XML集成的新手。我需要获取大量XML文件并将它们的副本保存到文件夹中。
示例xml(s):
http://simpsons.org/api/rest/v2/identities/HOMER
http://simpsons.org/api/rest/v2/identities/MARGE
http://simpsons.org/api/rest/v2/identities/BART
http://simpsons.org/api/rest/v2/identities/LISA
http://simpsons.org/api/rest/v2/identities/MAGGIE
...
文件夹示例:
C:\Users\myPC\Documents
现在,我希望能够使用基本网址:
http://simpsons.org/api/rest/v2/identities/
我还想使用一个命名范围“SimpsonsIdentities”,它填充了我想要的所有身份,添加到基本URL以及我将创建的已保存文件名称的末尾。为此,我将遍历“SimpsonsIdentities”范围内的每个名称。
SimpsonsIdentities
HOMER
MARGE
BART
LISA
MAGGIE
...
我认为基本结构将是这样的:
Sub SaveTheSimpsons ()
Dim n As Long
Dim BaseURL As String
Dim SimpsonsIdentitiesCount As Long
...
For n = 1 To SimpsonsIdentitiesCount
GET BaseURL & SimpsonsIdentity
SaveAs C:\Users\myPC\Documents & "\" & SimpsonsIdentity
Next n
End Sub
我非常感谢任何帮助。我甚至不确定斜杠应该以哪种方式保存文件。