|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
7 F5 e; v* x9 p9 ~
多加一行代碼就可以了…- ], r) c. d, k6 w6 z, Q: G5 M
6 K0 Z* t: D8 B& f ]" D- Option Explicit
0 x) [3 q k1 e - 3 I/ K- Y, a% b& z9 t
- Dim swApp As SldWorks.SldWorks. d7 Q) P3 E; L9 Z
- Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String$ Z' }5 [9 B0 E8 Z5 `! O; @' i
- Dim fileOptions As Long' j3 m7 j2 ]4 q! I1 q( d
9 t2 x7 W, R% M3 ]- Sub main()' {; Y7 }/ y! w- y5 o F" S
- Set swApp = Application.SldWorks7 \& D- W& R. _$ q2 F/ n/ J0 k1 q% U
- swFilter = "All(*.*)|*.*"& |+ l. D' B) M1 A6 {
- 4 O9 T6 k0 \" R
- ' Browse and get the Selected file name5 d4 H& g. ?* H1 s
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)4 T% ^" V0 O% C2 ?( |9 j& H% P. S
- ' Get the path of the selected file' `1 o% B3 C& a4 \$ n
- fileName = Left(fileName, InStrRev(fileName, ""))
0 T& H# W1 x6 n4 G- Y t# k - Debug.Print fileName! h; q3 J" |) M0 [4 D9 P [5 [
- End Sub
7 W1 f/ S2 S% ~# @
复制代码
* L) P( E, s. v$ X; i! E) |, ?2 \0 O' D6 B/ Z' O2 ]% G5 l4 O
|
|