几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-04-13, 03:21 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】want to make a browse button

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】how might i make this a sheetmetal componen yang686526 SolidWorks二次开发 0 2009-04-13 11:52 AM
【转帖】get write access button yang686526 SolidWorks二次开发 0 2009-04-13 11:03 AM
【转帖】make x button exit macro yang686526 SolidWorks二次开发 0 2009-04-12 09:44 PM
【转帖】how to grey out a customized macro button yang686526 SolidWorks二次开发 0 2009-04-12 09:20 PM
【转帖】VC6.0 控件Radio Button的使用 huangyhg vc编程 0 2009-03-22 10:29 PM


所有的时间均为北京时间。 现在的时间是 12:15 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多