几何尺寸与公差论坛

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

【转帖】question about input boxes

[复制链接]
发表于 2009-4-12 22:09:36 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 14:39 , Processed in 0.037935 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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