0
정보의 헤더 행을 CSV 파일에 배치해야하는 경우가 있습니다.데이터를 파일로 내보내기
그 후,이 파일에 다양한 열 번호의 3 개의 쿼리를 추가해야합니다.
현재이 논리를 가지고 있지만 TransferText
라인은 내가 이전에 파일에 배치 한 것을 덮어 쓰기 :
Dim fldr As String
Dim dlg As Office.FileDialog
Set dlg = Application.FileDialog(msoFileDialogFolderPicker)
With dlg
.AllowMultiSelect = False
.Title = "Select a Folder:"
.Filters.Clear
'.Filters.Add "CSV Files", "*.csv"
If .show = True Then
fldr = .SelectedItems(1)
End If
End With
GC dlg
'TODO: Remove after Debugging is complete
RaiseAlert "Folder chosen: " & fldr
'-----------------------------------------
Dim file As String
file = fldr & "\Export_DelaGet_" & Format(Now(), "yyyy_mm_dd") & ".csv"
'TODO: Remove after Debugging is complete
RaiseAlert "File: " & file
'-----------------------------------------
'TODO: OpenFile and output the header line
Open file For Output As #1
Print #1, """SYS"",""Some Data""" & vbCrLf
Close 1
'Output Query/View Results to file
DoCmd.TransferText acExportDelim, "MstPrc_Spec", "vwMasterPrices_Output", file, False
나를 그냥 레코드 집합을 통해 쿼리를 통해 반복하거나 내가 놓친 것이 좋을 것이다 TransferText의 무언가?
네 자신의 VB6 컬렉터를 만들었습니다. 그것의 조합은'Set = Nothing' (객체 일 경우)이고 RecordSet 객체가 ' .close' 인 경우입니다. 'ParamArray' 매개 변수가 필요합니다. 그래서 만약 내가 묶는 것이 필요하다면, 나는 그들을 쉼표로 구분할 수 있습니다. – GoldBishop