Article View: pl.comp.bazy-danych.msaccess
Article #137331Re: export kwerendy do pliku csv
From: MaciejF
Date: Wed, 30 Nov 2016 07:01
Date: Wed, 30 Nov 2016 07:01
42 lines
3877 bytes
3877 bytes
W dniu środa, 30 listopada 2016 07:54:35 UTC+1 użytkownik MaciejF napisał:
> W dniu środa, 30 listopada 2016 06:28:24 UTC+1 użytkownik Jan Koc napisał:
> > wyrzuca mi błąd w funkcji przy deklaracji
> >
> > Dim wb As Workbook
> >
> > czy brakuje jakiś referencji (we wcześniejszych postachh wypisałem je) ?
> >
> > Jan
>
> Referencja:
> Microsoft Excel Object Library
>
> przydatny link:
> http://stackoverflow.com/questions/5729195/how-to-refer-to-excel-objects-in-access-vba
Procedurka poprawiona
Sub txt2csv()
Dim fnam As String
Dim spath As String
Dim ftxt As String
Dim objExcelApp As Object
Dim wb As Object
Dim cel As Range
Dim txts As String
spath = "X:\"
fnam = Dir(spath & "*.txt")
Set objExcelApp = CreateObject("Excel.Application")
Do While fnam <> ""
Open spath & fnam For Input As #1
ftxt = Input(LOF(1), 1)
Close 1
ftxt = Replace(ftxt, "|", ",")
Open spath & Replace(UCase(fnam), ".TXT", ".csv") For Output As #1
Print #1, ftxt
Close 1
Set wb = objExcelApp.Workbooks.Open(spath & Replace(UCase(fnam), ".TXT", ".csv"))
wb.Close True
fnam = Dir
Loop
End Sub
Technical Details
Message-ID:
<e6b1f15d-aabf-4e8f-b5d7-4e15f47158f0@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!p16no133252qta.1!news-out.google.com!j8ni653qtc.0!nntp.google.com!p16no133248qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mailReferences:
<39d994b6-e28e-4fc2-a084-f06f776fd643@googlegroups.com> <1e537968-eeb9-4b13-b50b-b20a65c94981@googlegroups.com> <5adc9bd5-02aa-431a-9da5-4436331981d0@googlegroups.com> <e2bcce68-05b7-4f32-a98d-c29be8945003@googlegroups.com> <f0871dfd-9ee2-43a6-a20a-0c3c8c7b7c9e@googlegroups.com> <efb3385e-a83b-417d-ad7c-0ecf45246ed5@googlegroups.com> <23f5c5ff-a594-4fb9-8eb3-477cd7eebce0@googlegroups.com> <499a75f3-cb1d-45d9-b7e2-40edd8cf771f@googlegroups.com> <cfdcc8ae-3636-45a6-8e98-354ced6c90c0@googlegroups.com> <042100af-c425-4d32-a758-960f0de71417@googlegroups.com> <a6f43a6d-e9e3-47b6-843e-bb7903bbcdcb@googlegroups.com> <f9cd55f6-4b7b-4c72-82eb-4ddea936f4ed@googlegroups.com> <31f73f11-c349-4c21-abae-26b43a8882b7@googlegroups.com> <a64dbffe-2a58-4aab-8c40-f8b48c875bea@googlegroups.com> <a5ca3ae5-6d98-4c89-b3bf-0e8d06822c76@googlegroups.com> <5a5dd01d-5135-413e-b24a-f4430d7eef4a@googlegroups.com> <938c0682-bd58-46ae-b5cf-62127e958a5c@googlegroups.com> <aec03b3b-f433-47a1-ac61-ca4ffd7afa60@googlegroups.com> <3640a2e3-3162-4347-820a-489a7f87d7b8@googlegroups.com> <3dedb5cf-3118-40e7-aa67-fae3c319d006@googlegroups.com> <fe73f770-dd41-4201-b2ef-ae6d5c8a8b1d@googlegroups.com> <a7f33fbc-5ca1-41ad-b00e-71fb2669f2f6@googlegroups.com> <12c9ab06-3cf1-44e2-b59c-83d718d1bd5c@googlegroups.com>Show Full Headers
Complete Article Headers
X-Received: by 10.200.53.66 with SMTP id z2mr6591139qtb.42.1480489312296; Tue, 29 Nov 2016 23:01:52 -0800 (PST) X-Received: by 10.157.35.87 with SMTP id k23mr1498423otd.13.1480489312262; Tue, 29 Nov 2016 23:01:52 -0800 (PST) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!p16no133252qta.1!news-out.google.com!j8ni653qtc.0!nntp.google.com!p16no133248qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: pl.comp.bazy-danych.msaccess Date: Tue, 29 Nov 2016 23:01:51 -0800 (PST) In-Reply-To: <12c9ab06-3cf1-44e2-b59c-83d718d1bd5c@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=213.241.94.194; posting-account=kc7ZIQoAAAB5PkdJgxjq1dd8jnBK4MVp NNTP-Posting-Host: 213.241.94.194 References: <39d994b6-e28e-4fc2-a084-f06f776fd643@googlegroups.com> <1e537968-eeb9-4b13-b50b-b20a65c94981@googlegroups.com> <5adc9bd5-02aa-431a-9da5-4436331981d0@googlegroups.com> <e2bcce68-05b7-4f32-a98d-c29be8945003@googlegroups.com> <f0871dfd-9ee2-43a6-a20a-0c3c8c7b7c9e@googlegroups.com> <efb3385e-a83b-417d-ad7c-0ecf45246ed5@googlegroups.com> <23f5c5ff-a594-4fb9-8eb3-477cd7eebce0@googlegroups.com> <499a75f3-cb1d-45d9-b7e2-40edd8cf771f@googlegroups.com> <cfdcc8ae-3636-45a6-8e98-354ced6c90c0@googlegroups.com> <042100af-c425-4d32-a758-960f0de71417@googlegroups.com> <a6f43a6d-e9e3-47b6-843e-bb7903bbcdcb@googlegroups.com> <f9cd55f6-4b7b-4c72-82eb-4ddea936f4ed@googlegroups.com> <31f73f11-c349-4c21-abae-26b43a8882b7@googlegroups.com> <a64dbffe-2a58-4aab-8c40-f8b48c875bea@googlegroups.com> <a5ca3ae5-6d98-4c89-b3bf-0e8d06822c76@googlegroups.com> <5a5dd01d-5135-413e-b24a-f4430d7eef4a@googlegroups.com> <938c0682-bd58-46ae-b5cf-62127e958a5c@googlegroups.com> <aec03b3b-f433-47a1-ac61-ca4ffd7afa60@googlegroups.com> <3640a2e3-3162-4347-820a-489a7f87d7b8@googlegroups.com> <3dedb5cf-3118-40e7-aa67-fae3c319d006@googlegroups.com> <fe73f770-dd41-4201-b2ef-ae6d5c8a8b1d@googlegroups.com> <a7f33fbc-5ca1-41ad-b00e-71fb2669f2f6@googlegroups.com> <12c9ab06-3cf1-44e2-b59c-83d718d1bd5c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <e6b1f15d-aabf-4e8f-b5d7-4e15f47158f0@googlegroups.com> Subject: Re: export kwerendy do pliku csv From: MaciejF <maciejfr@onet.pl> Injection-Date: Wed, 30 Nov 2016 07:01:52 +0000 Lines: 47 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit