• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Xls dosyasını xml yapma

  • Konbuyu başlatan Konbuyu başlatan AURAS
  • Başlangıç tarihi Başlangıç tarihi
Katılım
7 Eylül 2009
Mesajlar
1
Excel Vers. ve Dili
exel 2007 türkçe
Arkadaşlar bende bir exel dosyası var ve bunu xml yapmam gerekiyor
bu konudada bilgim yok bana yardımcı olabilcek kimse varmı acaba
 
Bir siteden bulduğum örneği ekledim, bir deneyin.
Kod:
Sub Convert_Excel_Data_to_XML()
     Dim oMyconnection As Connection
     Dim oMyrecordset As Recordset
     Dim oMyXML As DOMDocument
     Dim oMyWorkbook As String

     Set oMyconnection = New Connection
     Set oMyrecordset = New Recordset
     Set oMyXML = New DOMDocument

     oMyWorkbook = Application.ThisWorkbook.FullName

     oMyconnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                      "Data Source=" & oMyWorkbook & ";" & _
                      "Extended Properties=excel 8.0;" & _
                      "Persist Security Info=False"

     oMyrecordset.Open "Select * from [Sheet1$A1:D43]", oMyconnection, adOpenStatic
     oMyrecordset.save oMyXML, adPersistXML
     oMyXML.save (ThisWorkbook.Path & "\Output.xml")
         oMyrecordset.Close
         Set oMyconnection = Nothing
         Set oMyrecordset = Nothing
         Set oMyXML = Nothing

End Sub
 
Geri
Üst