几何尺寸与公差论坛

 找回密码
 注册
查看: 891|回复: 0

【转帖】want to make a browse button

[复制链接]
发表于 2009-4-13 15:21:23 | 显示全部楼层 |阅读模式
want to make a browse button
hi everybody,
i want to make a macro that is going to be like a batch save as macro for dxf and pdf and i want to have a browse button or an open button to choose the file's or the folder that i want to open to save as. if anybody would have code like this or could easily make code like this or any help that would be great.! thanks
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
edited: 05/28/2008 at 06:19 pm by ben guenther
answer here is a code to call the browser and select a file you want to save as a pdf or dwf
public type browseinfo
howner as long
pidlroot as long
pszdisplayname as string
lpsztitle as string
ulflags as long
lpfn as long
lparam as long
iimage as long
end type
public const bif_returnonlyfsdirs = &h1
public const bif_dontgobelowdomain = &h2
public const bif_statustext = &h4
public const bif_returnfsancestors = &h8
public const bif_browseforcomputer = &h1000
public const bif_browseforprinter = &h2000
public const bif_newdialogstyle = &h40
declare function shgetpathfromidlist lib "shell32.dll" alias "shgetpathfromidlista" (byval pidl as long, byval pszpath as string) as long
declare function shbrowseforfolder lib "shell32.dll" alias "shbrowseforfoldera" (lpbrowseinfo as browseinfo) as long
public function getfolder(byval stitle as string) as string
dim binf as browseinfo
dim retval as long
dim pathid as long
dim retpath as string
dim offset as integer
binf.lpsztitle = stitle
binf.ulflags = bif_newdialogstyle
pathid = shbrowseforfolder(binf)
retpath = space$(512)
retval = shgetpathfromidlist(byval pathid, byval retpath)
if retval then
offset = instr(retpath, chr$(0))
getfolder = left$(retpath, offset - 1)
end if
end function
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
hi chris,
thanks for the reply! i am a bit of a dummy when it comes to code. what would i put in my browse button?
private sub commandbutton1_click()
end sub
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
edited: 05/28/2008 at 07:30 pm by ben guenther
create a new module ex. modbrowser and put the code i provided on it
and add this line to your command_click
private sub commandbutton1_click()
txtpath.text = getfolder("select a folder or whatever you want to promp here")
end sub
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
edited: 06/06/2008 at 02:51 pm by chris ch
very nice. i was looking for something like this.
thank you.
wally
thanks chris,
that worked great!. just what i wanted.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
ben,
if you ever need to select a file instead of a folder or opening/saving then the code is in the new macro on my site just for reference (
hi luke,
thanks! that is very much apreciated, i have not tried it yet but i would like to be able to select and folder and\or a file so this should work good!.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 12:51 , Processed in 0.033880 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表