7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command7_Click()
Dim i As Integer, j As Integer, n As Integer
Screen.MousePointer = vbHourglass
CommonDialog2.Filter = "All Files(*.*)|*.*|Text Files(*.txt)|*.txt"
CommonDialog2.FilterIndex = 2
CommonDialog2.DefaultExt = "txt"
CommonDialog2.ShowSave
If CommonDialog2.FileName <> "" Then
If Dir(CommonDialog2.FileName) <> vbNullString Then
If MsgBox("原文件存在,是否覆盖?", vbYesNo, "提示框") = vbYes Then
Kill CommonDialog2.FileName
Else
Exit Sub
End If
End If
Open CommonDialog2.FileName For Output As #2
For i = 0 To Form9.list1.ListCount - 1
Print #2, "009" & Form9.list1.List(i)
Next
For i = 0 To Form7.list1.ListCount - 1
Print #2, "007" & Form7.list1.List(i)
Next
For i = 0 To Form10.list1.ListCount - 1
Print #2, "010" & Form10.list1.List(i)
Next
Close #2
End If
Screen.MousePointer = vbDefault
End Sub
Private Function OpenFile(ByVal FileName As String) As DataInfo()
Dim Data() As DataInfo
Dim count As Long
Dim sData() As String
dim hFile as long
hFile=freefile
Open FileName For Input As hFile
sData = Split(StrConv(InputB(LOF(hFile), hFile), vbUnicode), vbCrLf)
Close
ReDim Data(1 To UBound(sData) + 1)
For count = 0 To UBound(sData)
Data(count + 1).PartName = Trim(Split(Trim(sData(count)), ",")(0))
Data(count + 1).PartNumber = Trim(Split(Trim(sData(count)), ",")(1))
Next
OpenFile = Data
End Function