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

[µo°Ý] ¨Ï¥Î FileDialog °ÝÃD [¤w¸Ñ¨M]

[µo°Ý] ¨Ï¥Î FileDialog °ÝÃD [¤w¸Ñ¨M]

¥»©«³Ì«á¥Ñ jimmyhk ©ó 2011-9-14 19:17 ½s¿è

§Ú«Ø¥ß¤F¤@­Óªí³æ, ·í«ö¤F CommandButton2 ¤§«á´N·|¶}¤@­ÓÂsÄý¸ê®Æ§¨ªºª«¥ó,
¥Î§@¿ï¾Ü¸ê®Æ§¨, ¤Î«á§â¿ï¾Ü¤Fªº¸ê®Æ§¨¸ô®|¦s©ñ¨ì Data_Field ªº D24 ¤º,
¤º®e¦p¤U:

Private Sub CommandButton2_Click()
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFolderPicker)
    If fd.Show = -1 Then MsgBox "²{¦b±NÀx¦s¨ì " & fd.SelectedItems(1) & "/  .  ½Ð«ö½T©wÄ~Äò"

Sheets("Data_Field").Select
Range("D24").Value = fd.SelectedItems(1)  '¦pªG¨Ï¥ÎªÌ¦b FileDialog ¶}±Ò®É¨S¦³«ö½T©w, «ö¤F¨ú®øÁä, ´N·|°±¦b³o¸Ì.   À³«ç»ò¿ì?
Unload ChoiceSaveLocation
End Sub

¦^´_ 1# jimmyhk
¸Õ¸Õ¬Ý
  1. Private Sub CommandButton2_Click()
  2.     Dim fd As FileDialog
  3.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  4.     If fd.Show = -1 Then
  5.        If MsgBox("²{¦b±NÀx¦s¨ì " & fd.SelectedItems(1) & "/  .  ½Ð«ö½T©wÄ~Äò", vbYesNo) = vbYes Then
  6.             Sheets("Data_Field").Select
  7.             Range("D24").Value = fd.SelectedItems(1)  
  8.             Unload ChoiceSaveLocation
  9.         End If
  10.     End If
  11. End Sub
½Æ»s¥N½X

TOP

®@~~~  ©ó¸Ì­±¦A¥[¤@­Ó if case...  um.....  ¦n
¸Õ¤@¤U¥ý~

TOP

¦^´_ 2# GBKEE

³Ì«á§ÚÂà¤F¥t¤@­Ó¤èªk³B²z,
¤£ª¾³o­Ó¦n¤£¦n~
  1. Private Sub CommandButton2_Click()
  2.     Dim fd As FileDialog
  3.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  4.     fd.InitialFileName = "d:\"  '¦pªG¥Î®a«ö¨ú®ø´N·|°õ¦æ RunAgain
  5. On Error GoTo RunAgain
  6.     If fd.Show = -1 Then MsgBox "ÀÉ®×±NÀx¦s¨ì " & fd.SelectedItems(1) & "\  , ½Ð«ö½T©wÄ~Äò."

  7. RunAgain:
  8. Select Case Err.Number
  9. Case 5
  10. Unload ChoiceSaveLocation
  11. ChoiceSaveLocation.Show
  12. End Select

  13. Sheets("Data_Field").Select
  14. Range("D24").Value = fd.SelectedItems(1)

  15. If Range("D24") <> Range("G24") Then
  16.     AskChangeDefaultBox.Show
  17.     Else
  18.     Sheets("Input").Select
  19.     Unload ChoiceSaveLocation
  20. End If
  21. Unload ChoiceSaveLocation
  22. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# jimmyhk
¨Ï¥Î On Error GoTo RunAgain   ¦b³oµ{§Ç¤¤¤@¦³ ¿ù»~ ´N·|¾É¤Þ¨ì RunAgain  ­n¤p¤ß¨Ï¥Î
  1. Private Sub CommandButton2_Click()
  2.     Dim fd As FileDialog
  3.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  4.     fd.InitialFileName = "d:\"  '¦pªG¥Î®a«ö¨ú®ø´N·|°õ¦æ RunAgain
  5. On Error GoTo RunAgain
  6.     If fd.Show = -1 Then MsgBox "ÀÉ®×±NÀx¦s¨ì " & fd.SelectedItems(1) & "\  , ½Ð«ö½T©wÄ~Äò."
  7.               '**************³oMsgBox ¦³«ö¨S«ö³£¨S§@¥Î?????**********
  8. Sheets("Data_Field").Select
  9. Range("D24").Value = fd.SelectedItems(1)
  10. If Range("D24") <> Range("G24") Then
  11.     AskChangeDefaultBox.Show
  12.     Else
  13.     Sheets("Input").Select
  14.     Unload ChoiceSaveLocation
  15. End If
  16. Unload ChoiceSaveLocation
  17. Exit Sub
  18. '''''''¤@¯ë³B¸Ì¿ù»~³£·|¸m©óµ{§Ç©³³¡   '''''''
  19. RunAgain:
  20. Select Case Err.Number
  21. Case 5
  22. Unload ChoiceSaveLocation
  23. ChoiceSaveLocation.Show
  24. End Select
  25. Resume          'ªð¦^²£¥Í¿ù»~ªºµ{¦¡½X
  26. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# GBKEE
  1. Private Sub CommandButton2_Click()
  2.     Dim fd As FileDialog
  3.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  4.     fd.InitialFileName = "d:\"  '¦pªG¥Î®a«ö¨ú®ø´N·|°õ¦æ RunAgain
  5. On Error GoTo RunAgain
  6.     If fd.Show = -1 Then MsgBox "ÀÉ®×±NÀx¦s¨ì " & fd.SelectedItems(1) & "\  , ½Ð«ö½T©wÄ~Äò."
  7.               '**************³oMsgBox ¦³«ö¨S«ö³£¨S§@¥Î?????**********  <³o¬O¨S¦³¥Îªº, ¥u¬O§@¤@­Ó¤p´£¿ô
  8. Sheets("Data_Field").Select
  9. Range("D24").Value = fd.SelectedItems(1)
  10. If Range("D24") <> Range("G24") Then
  11.     AskChangeDefaultBox.Show
  12.     Else
  13.     Sheets("Input").Select
  14.     Unload ChoiceSaveLocation
  15. End If
  16. Unload ChoiceSaveLocation
  17. Exit Sub
  18. '''''''¤@¯ë³B¸Ì¿ù»~³£·|¸m©óµ{§Ç©³³¡   ''''''' <- ©ú¥Õ
  19. RunAgain:
  20. Select Case Err.Number
  21. Case 5 '  **§Ú´N¬O©È·|¦³¨ä¥L¿ù»~, ©Ò¥H¨M©w¥u¦³ Case 5 ¤~°õ¦æ­«¿ï.  
  22. Unload ChoiceSaveLocation
  23. ChoiceSaveLocation.Show
  24. End Select
  25. Resume          'ªð¦^²£¥Í¿ù»~ªºµ{¦¡½X <- ¦b³o¥[³o¤@¥yªº­ì¦]¬O ?  ¦]¬°²{¦b¦pªG¨Ï¥ÎªÌ¦b«ö¨ú®ø«á¤w·|¦Û°Ê­«·s¦æ¤@¦¸ Unload ChoiceSaveLocation ©M ChoiceSaveLoction.show, ¥[¤Jªº¥Øªº¬O?
  26. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-9-14 20:14 ½s¿è

¦^´_ 6# jimmyhk
Resume    ³o¥[³o¤@¥yªº­ì¦]¬O    
¤@¯ë³£¬O¿ù»~¤w³B¸Ì§¹«á, ¿ù»~¤w®ø¥¢¤F.¥i¦^¥h­ì¨Óªº¨º¤@¦æµ{¦¡½X.

TOP

¦^´_ 7# GBKEE


®ø¥¢¬O¦³Ãö¿ù»~¤w¸Ñ¨MÁÙ¬Oµ¹¿ù»~°T®§¼u¥X«á¥i¥HÄ~Äò°õ¦æ¨ä¥L¨BÆJ?

TOP

¦^´_ 8# jimmyhk
Resume
¤@¯ë³£¬O¿ù»~¤w³B¸Ì§¹«á, ¨º­Ó¿ù»~¤w®ø¥¢¤F.¥i¦^¥h­ì¨Óªº¨º¤@¦æÄ~Äòµ{¦¡½Xªº¹B¦æ.

TOP

¦^´_ 9# GBKEE


®@~  ©ú¥Õ~  thx~~~

TOP

        ÀR«ä¦Û¦b : «Ý¤H°h¤@¨B¡A·R¤H¼e¤@¤o¡A´N·|¬¡±o«Ü§Ö¼Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD