solidworks vba 导出数据到文本文件

发布时间 2023-05-27 13:15:40作者: cuishengli

This macro exports all the information into the output text file in the following format:

Option Explicit

Const currentDir As String = "D:\"

' Dim swApp As SldWorks.SldWorks

Sub main()
    Dim filePath As String
    filePath = currentDir & "abc.txt"
    Dim fileNmb As Integer
    fileNmb = FreeFile
    Open filePath For Output As #fileNmb
    Print #fileNmb, "anything"
    Close #fileNmb
End Sub