我在 Microsoft Office Word 2003 中有这个宏代码,它读取文本文件的行。每行代表一个字符串值,稍后我需要在代码中使用它。
但是,文本文件的前两行包含一些我不需要的内容。如何修改代码以跳过前两行?Word 中 VBA 编辑器中的“智能感知”很糟糕。
无论如何,代码看起来像这样
Dim sFileName As String
Dim iFileNum As Integer
Dim sBuf As String
Dim Fields as String
sFileName = "c:\fields.ini"
''//Does the file exist?
If Len(Dir$(sFileName)) = 0 Then
MsgBox ("Cannot find fields.ini")
End If
iFileNum = FreeFile()
Open sFileName For Input As iFileNum
Do While Not EOF(iFileNum)
Line Input #iFileNum, Fields
MsgBox (Fields)
这段代码目前给了我所有的行,我不想要前两行。