|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
1 G' T& @# Q6 v- x2 J
多加一行代碼就可以了…; G" D. Y H. ?6 ]3 h
- q. ?9 `# ~3 z- s9 l" I+ l# d- Option Explicit
! e+ w6 p6 ~0 e/ ]+ a
3 E7 N/ h2 z' g! D- Dim swApp As SldWorks.SldWorks, u8 q1 s, D, f {: p8 d
- Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String
& f% V+ L6 ?( M3 u' R2 ^) u! K) ]' P - Dim fileOptions As Long) Z$ ~% R$ d0 @. Y, }
- ' Q/ P7 {/ ?; Y0 c
- Sub main()
0 s' ]' m! e @' G0 n' G' H5 ~; l - Set swApp = Application.SldWorks/ d" k) d, h7 N5 A- L8 K- ~) t
- swFilter = "All(*.*)|*.*"
2 U0 J- V& I& Y - 1 d7 _+ Z! I: ~2 V' |# H3 b6 w/ O
- ' Browse and get the Selected file name5 H3 O8 T% X8 M" O! F
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)
# D) C/ q- s+ y* v - ' Get the path of the selected file/ Y, Y- B Y2 u, r! }! I
- fileName = Left(fileName, InStrRev(fileName, ""))( m& @: W* o! y$ I
- Debug.Print fileName
4 j l5 p+ l- T1 a% S# X" R( E - End Sub
( `( Q( P( y" q
复制代码
, Y3 l6 ]: l1 a+ a* I" l f/ F; m
|
|