以下是我在vb6.0中将excel中单元格区域的数据存入二进制文件的代码,在vb.net中无法使用open 文件名 for binary as 文件号,该怎么处理?
Private Sub Form_Load()
Dim mc, cs, sjk, dth As String
Me.Hide
With xlapp.ActiveWorkbook.Sheets("线路要素")
mc = .[b1].Text '线路名称
cs = .[c4:c17]
sjk = .Range("e4:v" & .UsedRange.Rows.Count)
End With
If mc = "" Then MsgBox "请输入线路名称!", 64, "AutoRBC": GoTo 100
With Me.CommonDialog1
.InitDir = App.Path
.FileName = mc
.Filter = "数据库文件(.qc)|.qc"
.ShowSave
dth = .FileName
End With
If Right(dth, 2) = "qc" Then
On Error Resume Next
Kill dth
On Error GoTo 0
Open dth For Binary As #1
Put #1, , mc
Put #1, , cs
Put #1, , sjk
Close #1
End If
100
Unload Form4
End Sub