ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] inputbox + select case ºÃ°Ý

[µo°Ý] inputbox + select case ºÃ°Ý

¥¼­×§ï«eªº®É­Ô,¤p§Ì¥u¯à¿é¤J¯S©w­È(¤p§Ì³]©w¬°0),¤~¯àÂ÷¶} inputbox §_«h·|¤@ª½­«·s­n¨D¿é¤J
«á¨Ó¤p§Ì±N inputbox ­×§ï¦¨  Application.InputBox ´N¥i¥Hª½±µ«ö¨ú®øÂ÷¶} inputbox
³o¼ËÀ³¸Ó¬O¤£»Ý­n case 0ªº³¡¥÷ ¤~¹ï ¥i¬O±N case 0 ¤]´N¬O¬õ¦â³¡¥÷®³±¼«á
°õ¦æ®É­n«ö¨ú®ø´N·|Åܦ¨­n¨D­«·s¿é¤J µLªkÂ÷¶}
¯à§_¦³°ª¤â¸Ñ´b©O????

¥N½X¦p¤U
Sub TA()
re: x = InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
Select Case x
Case 1
Shell "D:\vncviewer.exe 111.99.67.64 /password cimeng"
Case 2
Shell "D:\vncviewer.exe 111.99.67.84 /password cimeng"
Case 0
GoTo a
Case Else
MsgBox "½Ð­«·s¿é¤J"
GoTo re
a:
End Select
End Sub

¤j¤j¦n  
case 0  ÁÙ¬O­n«O¯d
«ö¨ú®ø®É¬Oªð¦^ "" ªÅ¥Õ­È

Sub TA()
re: x = InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
Select Case x
Case 0, ""
Case 1
Shell "D:\vncviewer.exe 111.99.67.64 /password cimeng"
Case 2
Shell "D:\vncviewer.exe 111.99.67.84 /password cimeng"
Case Else
MsgBox "½Ð­«·s¿é¤J"
GoTo re
End Select
End Sub

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2015-12-13 17:10 ½s¿è

x = InputBox(¡ã¡ã)¡@
µLªk¤À¿ë¡e¥¼¿é¤J¡f«öenter¡A©Î«ö¡e¨ú®ø¡f©Ò²£¥Íªº¡eªÅ¦r²Å""¡f¡A
¥i¥Î¡@If StrPtr(x) = 0 Then¡@§PÂ_¨ä¬°«ö¡e¨ú®ø¡f¤§°Ê§@¡]¤£ºÞ¦³µL¿é¤J¡^¡I¦ý¨Ã«D©Ò¦³officeª©¥»¾A¥Î¡I¡I¡I
Re: X = InputBox("½Ð¿é¤J¿ï¶µ")
If StrPtr(X) = 0 Then Exit Sub
Select Case X
¡@¡@Case 1: MsgBox "¿ï¶µ1"
¡@¡@Case 2: MsgBox "¿ï¶µ2"
¡@¡@Case Else: GoTo Re
End Select

¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
x = Application.InputBox(¡ã¡ã)¡@
µLªk¤À¿ì¿é¤J¢¯«öenter¡A©Î«ö¨ú®ø¤§False¡]¨t²ÎµøFalse¬°¢¯¡^¡A
¥i¥Î¡@If x & "" = "False" Then¡@§PÂ_¨ä¬°«ö¡e¨ú®ø¡f¤§°Ê§@¡]¤£ºÞ¦³µL¿é¤J¡^!
³o¤èªk¬O±j¨î±NFalseÂର¤å¦r¡A¦Ó¤£¬Oµ¥¦P¢¯ªºÅÞ¿è­È¡I
Re: X = Application.InputBox("½Ð¿é¤J¿ï¶µ")
If X & "" = "False" Then Exit Sub
Select Case X
¡@¡@Case 1: MsgBox "¿ï¶µ1"
¡@¡@Case 2: MsgBox "¿ï¶µ2"
¡@¡@Case Else: GoTo Re
End Select

TOP

  1. Sub TA()
  2.   Dim X As Variant
  3.   Dim Y As Long
  4.   
  5.   On Error Resume Next
  6.   X = Application.InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
  7.   Do While VarType(X) <> vbBoolean
  8.     Y = -1: Y = CLng(X): X = False
  9.     Select Case Y
  10.       Case 1:     'Shell "D:\vncviewer.exe 111.99.67.64 /password cimeng"
  11.       Case 2:     'Shell "D:\vncviewer.exe 111.99.67.84 /password cimeng"
  12.       Case Else:  MsgBox "½Ð­«·s¿é¤J"
  13.     End Select
  14.     X = Application.InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
  15.   Loop
  16. End Sub
½Æ»s¥N½X
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

¥¼­×§ï«eªº®É­Ô,¤p§Ì¥u¯à¿é¤J¯S©w­È(¤p§Ì³]©w¬°0),¤~¯àÂ÷¶} inputbox §_«h·|¤@ª½­«·s­n¨D¿é¤J
«á¨Ó¤p§Ì±N  ...
feecshyrnd µoªí©ó 2015-12-12 22:20
  1. Sub TA()
  2.   Dim X As Variant
  3.   Dim Y As Long
  4.   
  5.   On Error Resume Next
  6.   X = Application.InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
  7.   Do While VarType(X) <> vbBoolean
  8.     Y = -1: Y = CLng(X): X = False
  9.     Select Case Y
  10.       Case 1:     Shell "D:\vncviewer.exe 111.99.67.64 /password cimeng"
  11.       Case 2:     Shell "D:\vncviewer.exe 111.99.67.84 /password cimeng"
  12.       Case Else:  MsgBox "½Ð­«·s¿é¤J"
  13.     End Select
  14.     X = Application.InputBox("½Ð¿é¤J¹wÂsÄý¤§¹q¸£", , "½Ð¿é¤J¼Æ¦r <¨Ò¦p 1 > ©Î¿é¤J 0 ¨ú®ø")
  15.   Loop
  16. End Sub
½Æ»s¥N½X
¤£¦n·N«ä¡A¼Ó¤Wªº¥N½X§Ú§â§A­n°õ¦æªºShell¾Þ§@µùÄÀ±¼¤F¡C³o¼h¥N½X­×§ï¥¿±`¤F¡C
Application.InputBox«ö"¨ú®ø"®Éªð¦^False¡A¦ýInputbox«ö¡§¨ú®ø¡¨®Éªð¦^ªº­È¬O""¡A¤£¾A¥Î¥»¨Ò¡C
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD