应该是
用fso 或者用open xmlfile.xml as #1 都行。

解决方案 »

  1.   

    sorry 应该是open "xmlfile.xml" for output as #1
      

  2.   

    Sub LoadSchedule()
    Public XMLRst As ADODB.RecordsetDim fso As Object
     
        Set fso = CreateObject("Scripting.FileSystemObject")
        Set XMLRst = New ADODB.Recordset
         If fso.FileExists(mstrFile) Then
            XMLRst .Open mstrFile
        Else
            XMLRst .Fields.Append "Remote Server", adVarChar, 128
            XMLRst .Fields.Append "Remote UID", adVarChar, 128
            XMLRst .Fields.Append "Remote PWD", adVarChar, 128
            XMLRst .Fields.Append "Remote Path", adVarChar, 128
            XMLRst .Fields.Append "Remote File", adVarChar, 128
            XMLRst .Fields.Append "Local Path", adVarChar, 128
            XMLRst .Fields.Append "Local File", adVarChar, 128
            XMLRst .Fields.Append "FileSize", adDouble
            XMLRst .Open
            XMLRst .Save mstrFile, adPersistXML
       End If
      

  3.   

    With XMLRst 
            .AddNew
            .Fields("Remote Server") = CStr(Label1(0).Caption)
            .Fields("Remote UID") = CStr(Label1(1).Caption)
            .Fields("Remote PWD") = CStr(Label1(2).Caption)
            .Fields("Remote Path") = CStr(Label1(3).Caption)
            .Fields("Remote File") = CStr(Label1(4).Caption)
            .Fields("Local Path") = CStr(Label1(5).Caption)
            .Fields("Local File") = CStr(Label1(6).Caption)
            .Fields("FileSize") = CDbl(Label1(7).Caption)
            .Update
            .Save , adPersistXML
        End With