Problems saving XML file: Run-time error

A

Alan

I am using the MSXML library from VBA code in Excel 2007 on Windows
Vista. Everything works fine until I try to save an XML file with
this code:

Const MyLocation = "C:\Users\Alan\Desktop"
. . .
Set objDom = New DOMDocument
. . .
objDom.Save (MyLocation)

At that last line, I get the following error:

Run-time error '-2147024891 (80070005)':
Access is denied

Why would it not let me save a file?

Thanks, Alan
 
B

Barb Reinhardt

When I save an Excel document using saveas, I need to do something like this

myWB.SaveAs filename:="C:\abc23.xls" fileformat:=56

I'm not seeing a file name, or a fileformat in your saveas line.

This page from Ron de Bruin should help

http://www.rondebruin.nl/saveas.htm
 
A

Alan

Barb,

Thanks, but I am saving an XML file using MSXML in Excel. I am not
saving an Excel file.

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top