|
question about input boxes
with the help of you guys and a local user group, i now have a macro for sending files to our nc dept. we prefer giving them copies instead of allowing them access to the originals.
anyway, this macro calls up an input box for a file name.
i've noticed that the first time i run the macro in a session, the input box is minimized in the taskbar. after that, the next time i run the macro the input box will be centered on the screen. why is that? is there a line of code i need to add so the box will be centered on the screen the first time its run?
its a minor thing, i'm just curious.
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
can you paste the code in question? a vba inputbox can't be minimized to the taskbar as far as i know! is it really minimized to the taskbar, or is it behind the active window?
i'll get you eh steve, if it's the last thing i dooooo!
you got me to wondering, josh, if the input box was behind the sw window.
i just ran it again and i can't minimize sw or click on other taskbar icons until i click on the input box icon in the taskbar. anyway, here's my code. i'm still new at vb so i'm sure some of you experts out there would write it differently. but, hey, it works for me.
option explicit
dim swapp as object
dim part as object
dim selmgr as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
dim feature as object
dim filename as string
dim suffix as string
dim cncdir as string
dim dump as string
dim strtitl as string
dim strlength as integer
dim strdefaultname as string
dim strdonametest as string
dim strdir as string
dim intnameexist as integer
sub main()
suffix = "sldprt"
cncdir = "o:\drawings"
set swapp = application.sldworks
set part = swapp.activedoc
strtitl = swapp.activedoc.gettitle()
strlength = (len(strtitl) - 7)
strdefaultname = left(strtitl, strlength)
set selmgr = part.selectionmanager
strdonametest = "t"
do while (strdonametest = "t")
filename = inputbox("enter cnc file name:", "cnc file name in o:\drawings\", strdefaultname)
dump = cncdir & "\" & filename & "." & suffix
strdir = dir(dump)
if (strdir = "") then
strdonametest = "f"
else
intnameexist = msgbox((dump) & " already exists." & (chr(13)) & "do you want to replace it?", vbexclamation + vbyesno + vbdefaultbutton1, "cnc file name")
end if
if (intnameexist = 6) then
strdonametest = "f"
end if
loop
part.saveas2 dump, 0, true, false
end sub
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
i tried out your code and i can't reproduce your issue. i don't even get a taskbar icon for an inputbox. however, i'm on xp pro 32 bit. this may be a vista- or x64-specific thing. have you tried messing around with the optional xloc and yloc arguments of the inputbox?
i'll get you eh steve, if it's the last thing i dooooo!
edited: 01/08/2009 at 09:12 am by josh brady
josh, this just might be a vista thing. i tried setting the xpos and ypos with no difference in result. i did notice (maybe i never paid any attention before) that when i tried to open the vb editor within sw, the editor was minimized to the taskbar, also. any other vista users out there see this?
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
quick |
|