|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
) t: Y- B1 p9 \, F1 Y# q* m多加一行代碼就可以了…
. P, w& B% ^7 k: p+ l
+ P# z A/ Q+ A ^+ H1 n! m4 a- Option Explicit1 w2 [4 D" R5 m/ z* R
& d1 o4 t* A6 Z- Dim swApp As SldWorks.SldWorks" x" u+ u! J* F2 h
- Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String; H6 a8 n0 g. F$ g O7 N8 _6 H/ U
- Dim fileOptions As Long* h5 ~) \" O# X9 r
/ a6 I1 Q. e- ]+ U5 n. P9 ?- Sub main()1 f" A( ~5 A! Z7 R0 T
- Set swApp = Application.SldWorks X8 j' z3 v: p' y7 t
- swFilter = "All(*.*)|*.*"* Y& x s! K% t: U5 S
- ' _/ b2 @0 p) r, C6 a
- ' Browse and get the Selected file name
% T( o* R! K. t* |1 S - fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)
* S7 Q/ c' w1 S& ]7 |. X- {, P( o4 \9 M - ' Get the path of the selected file
: m* J' i, ^8 q6 l: n+ v; j6 _ - fileName = Left(fileName, InStrRev(fileName, ""))/ y+ x8 A3 z7 r
- Debug.Print fileName
- A! y p; m# g+ W; N2 _ - End Sub: Y6 J) n$ n. h; p
复制代码
( v% s3 J9 D4 t7 F1 _8 r8 O' T
. Z) q0 g7 Q* S- O6 m% i |
|