🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych.msaccess
Article #137629

Re: Tworzenie pliku xml dla danych z tabeli za pomocą pliku vbs

#137629
From: Zbigniew Bratko
Date: Mon, 30 Jul 2018 13:13
57 lines
2578 bytes
W dniu 2018-07-30 o 14:04, Phantom pisze:
> Działa!
> Nawet podmienia plik xml na nowy (wielokrotne wywoływanie funkcji).
> Zastanawiam się czy dla pewności nie usuwać starego pliku xml przed tworzeniem nowego.
> 
> Moja funkcja wygląda teraz tak:
> 
> Const acExportTable = 0
> Const acQuitSaveNone = 2
> Const acUTF8 = 0
> Dim oApp
> 
>     Set oApp = CreateObject("Access.Application")
>       oApp.OpenCurrentDatabase "G:\Dec_Publ.mdb", False
>       oApp.ExportXML acExportTable, "Dec_Publ_Tab", "G:\Dec_Publ_Tab_Proba.xml", , , , acUTF8
>       oApp.CloseCurrentDatabase
>       oApp.Quit acQuitSaveNone
>     Set oApp = Nothing
> 
> Brakuje linii z usuwaniem pliku.
> Jeśli można prosić!

[...]

Mniej więcej będzie to tak:
'___________________________________________________________
Option Explicit

Dim oApp
Dim oFSO
Const acExportTable = 0
Const acQuitSaveNone = 2
Const acUTF8 = 0
Const cFileXML = "G:\Dec_Publ_Tab_Proba.xml"

   Set oFSO = CreateObject("Scripting.FileSystemObject")
     With oFSO
       If .FileExists(cFileXML) Then
           .DeleteFile (cFileXML)
       End If
     End With
   Set oFSO = Nothing

   Set oApp = CreateObject("Access.Application")
     With oApp
       .OpenCurrentDatabase "G:\Dec_Publ.mdb", False
       .ExportXML acExportTable, "Dec_Publ_Tab", cFileXML, , , , acUTF8
       .CloseCurrentDatabase
       .Quit acQuitSaveNone
     End With
   Set oApp = Nothing

-- 
Pozdrowienia
BraZby
www.faq.accdb.pl
www.accdb.pl
Technical Details
Message-ID: <pjn2tb$hlv$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <ba1c4dee-528e-43b7-924e-7932bef57f48@googlegroups.com> <pjmhc3$1b7$1@node2.news.atman.pl> <ab6cf269-fae2-4f89-bd3e-2bb1c779a5aa@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Zbigniew Bratko <byle@co.pl>
Newsgroups: pl.comp.bazy-danych.msaccess
Subject: Re: Tworzenie pliku xml dla danych z tabeli za
 pomocą pliku vbs
Date: Mon, 30 Jul 2018 15:13:09 +0200
Organization: ATMAN - ATM S.A.
Lines: 57
Message-ID: <pjn2tb$hlv$1@node2.news.atman.pl>
References: <ba1c4dee-528e-43b7-924e-7932bef57f48@googlegroups.com> <pjmhc3$1b7$1@node2.news.atman.pl> <ab6cf269-fae2-4f89-bd3e-2bb1c779a5aa@googlegroups.com>
NNTP-Posting-Host: 37.248.155.230
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1532956396 18111 37.248.155.230 (30 Jul 2018 13:13:16 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Mon, 30 Jul 2018 13:13:16 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
In-Reply-To: <ab6cf269-fae2-4f89-bd3e-2bb1c779a5aa@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit