|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
+ h k3 ^$ r( ?
多加一行代碼就可以了…, ^& X) l1 ~- X K
* R8 W& q- S, S6 @& U, M5 _% q, i- Option Explicit+ ~: e5 ^2 g1 e7 v
7 f2 W- W1 P# c- S; G" y- Dim swApp As SldWorks.SldWorks
+ D4 T+ v/ U1 R# T - Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String
) Y0 h" B0 M9 X4 w0 G' t5 X* T - Dim fileOptions As Long
: E! p D& a( i S, T. H! j0 J
6 G4 i( L. D- ^, f. \; a- Sub main()
% T, [8 C3 N# ?5 |4 a- w - Set swApp = Application.SldWorks1 I6 _, {& }8 F$ j- g6 N; n4 u
- swFilter = "All(*.*)|*.*"
6 w0 t! |- l! j* P* I! Q# ?& u
3 E/ C; M/ D# N- ' Browse and get the Selected file name* J% H0 E) R0 X
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName): e2 J$ A; x* R' ?" J
- ' Get the path of the selected file
( K: S$ _5 T2 v) l: u) j - fileName = Left(fileName, InStrRev(fileName, "")). G. u8 W" b' U* c% b' a( ]
- Debug.Print fileName
5 _* V+ `, s0 i1 G/ t - End Sub8 c$ W+ O% T: _
复制代码
4 I, _3 a- b$ U2 j) K+ L" ^+ X0 G) m$ r$ ^& Z6 P( X
|
|