Rem "读取文件的第一行数据"
Public Function ReadFirstLineDataFromFile(fileName) As String
'声明
Dim filePath As String
Dim fs As Object
Dim otf As Object
'执行过程
filePath = fileName
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(filePath) = True Then
Set otf = fs.OpenTextFile(filePath, 1, True)
ReadFirstLineDataFromFile = otf.ReadLine()
otf.Close
Else
MsgBox "文件""" & fileName & """不存在"
End If
End Function
【SolidWorks宏】读取文件的第一行数据
最新推荐文章于 2025-01-14 09:17:54 发布