Hello,

I keep getting a runtime error 58 when it comes to overwriting an existing XML file. It gives me the error and I don't get the option to overwrite it. I'd rather that it not ask me and just overwrite the file. The code is below.

Sub MakeXML()

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adPersistXML = 1

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Dim Filename As String
Dim Filepath As String
Dim File As String

Filepath = "V:\9 O'Clock Meeting\billboard\"
Filename = "billboard" & " " & Format(Now)
File = Filepath & Filename & ".xml"
Application.DisplayAlerts = False

strFile = Workbooks(1).FullName

strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile _
        & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"

cn.Open strCon
rs.Open "Select * from [InfoSheet$]", cn, adOpenStatic, adLockOptimistic

If Not rs.EOF Then
    rs.MoveFirst

rs.Save "V:\9 O'Clock Meeting\billboard\billboard XML.xml", adPersistXML


End If

rs.Close
cn.Close
Application.DisplayAlerts = True
End Sub