|
|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
; R* R- l" l7 W( u- ]& s9 |+ A
多加一行代碼就可以了…
7 m2 X, S- i* E6 L7 d
& j+ I0 J3 R) A: B1 A* P" q8 m- Option Explicit. m2 m9 Z' ], ?
' T! ~2 t4 o7 i2 K- Dim swApp As SldWorks.SldWorks% e3 F- x2 d3 w# Z" `
- Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String
6 F' s2 p6 Z4 y0 k" G2 U% q - Dim fileOptions As Long
u4 z# B3 ^- z" `! a1 F - J+ n% Z1 v" c8 L7 D
- Sub main()
3 V8 m8 p1 I0 h: p* z! P* V( Z - Set swApp = Application.SldWorks
4 o% y0 z* Q1 e% ~; d* P1 y - swFilter = "All(*.*)|*.*"
8 l$ M' J# X- y2 z
2 ]+ \! h2 `0 \4 Z4 V. R- ' Browse and get the Selected file name6 b- l/ y( v# [& r
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)
6 }' N3 K* m( b! K* M - ' Get the path of the selected file8 [6 b3 ~: O" _4 z. m" T$ {
- fileName = Left(fileName, InStrRev(fileName, ""))" L* |% S" A! ?& s
- Debug.Print fileName
( U6 ?; [' I8 h - End Sub* O6 B9 z- O0 ?% w1 y( _* h- Z
复制代码
: C8 w' Z9 V0 ^: y( }% z3 q" H. O2 s$ Q
|
|