|
发表于 2022-12-13 13:31:53
|
显示全部楼层
来自: 中国台湾
% \! b' @$ b: U
多加一行代碼就可以了…
, w( Z8 A' S; T# i' n
. B2 H8 X: C5 g' ~) ?) P# i& W- Option Explicit
9 i* q4 C! ?. ? h
5 O) z+ x* S9 M4 q- I- Dim swApp As SldWorks.SldWorks
5 E4 { k) L8 i [4 X' q - Dim swFilter As String, fileName As String, fileConfig As String, fileDispName As String7 Q$ V2 G( |/ ?3 Z8 Z# U
- Dim fileOptions As Long! t% T/ }7 M8 |% e
- # Q$ g. R# P0 ^3 _: M* c2 V) A
- Sub main(), G9 K, U; ]$ y& x2 ^; B# s" z/ [3 t
- Set swApp = Application.SldWorks# J* \ z4 ^9 e, O
- swFilter = "All(*.*)|*.*"' X6 M$ @( c/ X' [% k% f
- $ g- D4 y4 J' T: |" R! {- B1 s
- ' Browse and get the Selected file name- s/ a+ K8 ^. G2 r( J: b6 _8 g
- fileName = swApp.GetOpenFileName("Browse Document", "", swFilter, fileOptions, fileConfig, fileDispName)
; P1 ~& H- y1 w% Q0 P - ' Get the path of the selected file m; v0 ]+ a4 R& N) C
- fileName = Left(fileName, InStrRev(fileName, ""))4 u6 \7 ~# l. a7 v
- Debug.Print fileName) p3 c7 f- [1 G: y, a
- End Sub
b7 Z3 C( }; l
复制代码
! M- R$ D- s3 E3 q
% U' F( `! v1 p9 ?0 N |
|