用计算机打出本机的名字,为什么系统用户名多出了本机计算机名的后缀

用 Microsoft Access 就可以打开 CSV 文件的。

然后再保存成mdb就行了。

CSV、MDB格式转换程序:

'///

'CSV < - >MDB Convert Tool

'Written By gyawjk

'///

Option Explicit

Private Sub Command1_Click()

On Error GoTo ErrHandler

CommonDialog1.FileName = ""

CommonDialog1.CancelError = True

CommonDialog1.Filter = "CSV File(*.csv;*.txt)|*.csv;*.txt"

CommonDialog1.ShowOpen

If CommonDialog1.FileName <> "" Then

Text1.Text = CommonDialog1.FileName

End If

Exit Sub

ErrHandler:

MsgBox "Error:" & Err.Description, vbCritical, "Error"

End Sub

Private Sub Command2_Click()

On Error GoTo ErrHandler

CommonDialog1.FileName = ""

CommonDialog1.CancelError = True

CommonDialog1.Filter = "Access File(*.mdb)|*.mdb"

CommonDialog1.ShowOpen

If CommonDialog1.FileName <> "" Then

Text2.Text = CommonDialog1.FileName

End If

Exit Sub

ErrHandler:

MsgBox "Error:" & Err.Description, vbCritical, "Error"

End Sub

Private Sub Command3_Click()

If Option1.Value = True Then

If Dir(Text1.Text) = "" Then

MsgBox "CSV文件不存在!", vbCritical, "错误"

Exit Sub

End If

If CSV2MDB(Text1.Text, Text2.Text) = True Then

MsgBox "导入表成功!", vbInformation, "提示"

End If

Else

If Dir(Text2.Text) = "" Then

MsgBox "CSV文件不存在!", vbCritical, "错误"

Exit Sub

End If

If MDB2CSV(Text2.Text, Text1.Text, "Book1") Then

MsgBox "导出CSV成功!", vbInformation, "提示"

End If

End If

End Sub

Private Function CSV2MDB(CSVFileName As String, MDBFileName As String, Optional TableName As String = "") As Boolean

On Error GoTo ErrHandler

Dim strTemp As String

Dim strCSVFile As String, strCSVLineSplit As String

Dim iCSVLineCount As Integer, iCSVFieldCount As Integer

Dim strArrCSVLine() As String, strArrCSVHead() As String, strArrCSVData() As String

Dim i As Integer, j As Integer, Ret As Long

Dim ADOXCat As ADOX.Catalog, ADOXTable As ADOX.Table

Dim ADOConn As ADODB.Connection, ADORs As ADODB.Recordset

Dim strCn As String

Dim FileNum As Integer

CSV2MDB = False

FileNum = FreeFile

Open CSVFileName For Input As FileNum

While Not EOF(FileNum)

strTemp = ""

Line Input #FileNum, strTemp

If Trim(strTemp) <> "" And Trim(strTemp) <> vbCrLf Then

If strCSVFile = "" Then

strCSVFile = strTemp

Else

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值