![]() |
【转帖】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 |
所有的时间均为北京时间。 现在的时间是 04:01 PM. |