|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
- L7 t e; d/ a# Z' s: N多加一行代碼就可以了…3 S) I( C$ s' S7 y
6 I, Z9 |* `; O" S
- Option Explicit9 W0 g3 z, q( R
: X4 K$ ` {# [& }8 [- Dim swApp As SldWorks.SldWorks
& ~" m5 i2 W7 w8 @5 l9 p - Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String
n2 z% f! ? c! _5 s- B, C" ? - Dim fileOptions As Long! }+ D$ b+ A! X( M I) F
- 3 w. Z! G( S3 ^- P; Q8 ^8 J
- Sub main()
* H" c1 c5 n, N: o - Set swApp = Application.SldWorks
. E' ]1 C5 J* w$ W - swFilter = "All(*.*)|*.*"
3 g; B. q) n- ~' T3 Y$ l! w& Z; v* M
9 Z& C+ U& u& e& }- ' Browse and get the Selected file name- B2 d8 m: l9 y$ i4 Z2 @
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName): Y8 J% \4 l2 l* R _( _$ p
- ' Get the path of the selected file
5 f. i6 Z1 Z) k2 P o - fileName = Left(fileName, InStrRev(fileName, "")): z2 w0 S6 G* m1 e
- Debug.Print fileName. p; Z: B) `! G$ ~( ?8 q
- End Sub p& D* C8 a0 E" `( p
复制代码 h( X# W, }! F9 K A
; S& i) m6 c/ n5 V E" r |
|