|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
# a$ K/ N2 e0 v& A# f7 K多加一行代碼就可以了…
* E! {8 s! g7 l8 h9 |3 d- y2 c5 C, Q- A8 l( @: M- _
- Option Explicit3 l, z; ^0 b" V( C$ w
i2 W, \5 g5 k; Y) @% S$ u$ D- Dim swApp As SldWorks.SldWorks
' c) z$ P4 d$ x - Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String4 ?' A: q) n; V# T. g6 m* T
- Dim fileOptions As Long
/ d" k; o- @' V* X$ b& Y, H - , S, [/ u \! p: U3 \, }; ?
- Sub main()$ e$ k' O, O( B: _, g0 q
- Set swApp = Application.SldWorks
- W- @7 s) {9 y. L% X - swFilter = "All(*.*)|*.*"
; R0 _4 \8 A; M# G. r
3 K; f; p- Y" _' g) j* Z/ B3 c& [- ' Browse and get the Selected file name
( A2 O# U- }. T l0 v - fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)5 }* }9 v; l- f$ X
- ' Get the path of the selected file. x- r& k: [8 n: T/ Z* |
- fileName = Left(fileName, InStrRev(fileName, ""))& \, }' s. c5 s! |* U) z& ?
- Debug.Print fileName1 Q, `) D5 D) K$ U
- End Sub1 _9 \9 f3 Y2 A. \
复制代码 : ~3 i, H7 L* P0 ^0 T
6 F X* t4 ?7 t. b/ P
|
|