View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
pmorgp pmorgp is offline
external usenet poster
 
Posts: 2
Default Import XML Problem

Hi,

one more detail that I just learned... it helped me out and who knows,
indirectly it might help you.

in addition tot he Workbook.XmlImport method, there's an XmlMap.Import
method. If I use the latter, I don't get prompted to pick an XML Map.

this works for me with no user interaction:

Sub SetFilter(token As String, filter As String)
'
'
''''''''''
Dim urlStr As String

''''''''''
urlStr = "http://server.compnay.com/api.asp?" & _
"cmd=saveFilter&" & _
"sFilter=" & filter & _
"&token=" & token

With Workbooks("Destination Workbook.xlsm")
.Activate
Worksheets("Destination Sheet").Activate

.XmlMaps("setFilterRespMap").Import urlStr
End With

End Sub

"MelMat" wrote:

I'm attempting to import XML data onto a worksheet in Excel 2003. If I
create
the VBA procedure and run it, it works just fine, as long as don't
close down
the application. I can re-run the import as many times as I like and
have no problems.

However, if I close down Excel, re-open it, then attempt
to run my procedure, I get a run-time error: -2147217376 (80041020).
The
description says, "A string literal was expected, but no opening
quote
character was found."

The code line looks like this (with, of course, a valid address):
ActiveWorkbook.XmlImport URL:= "http://..._getCPdata?year=2009&&;"
_
, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A
$1")

I've run out of things to try - anyone have any clue as to what I can
do?