|
我是一位菜鸟,向前辈请教一下如何用在EXCEL中利用MsgBox按格式打开文本文档,我记录了一下宏,说出错了,不知道错在哪里,万分感谢
Sub 输入Homax数据()
'
' 输入Homax数据 Macro
'
'
Dim str As String
Dim a As Workbook
Application.ScreenUpdating = True
str = Application.GetOpenFilename("TXT文件类型, *.*", _
1, "打开Homax数据", "Open")
If str <> "False" Then
Set a = Workbooks.Open(str)
End If
If a Is Nothing Then
MsgBox "Homax数据未打开!", vbYes, "提示"
Exit Sub
Else
Workbooks.OpenText Filename:= _
"str", Origin:=936, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _
Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3 _
, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, _
1), Array(11, 1)), TrailingMinusNumbers:=True |
|