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

[µo°Ý] ¦¹¬qµ{¦¡¤¤¦p¦ó¥[¤@­Ó§PÂ_¡H

[µo°Ý] ¦¹¬qµ{¦¡¤¤¦p¦ó¥[¤@­Ó§PÂ_¡H

  1. Sub OpenPath()

  2. Dim fd As FileDialog, FileName As String, FileFolder As String

  3. Set fd = Application.FileDialog(msoFileDialogFolderPicker)

  4. With fd
  5.     .AllowMultiSelect = False
  6.     If .Show = -1 Then
  7.         FileFolder = .SelectedItems(1)
  8.     Else
  9.         End
  10.     End If
  11. End With

  12. Set fd = Nothing

  13. End Sub
½Æ»s¥N½X
¦p¦ó¥[¤@­Ó§PÂ_¦pªG¨S¦³¿ï¨ú®É´N¤£¯àÂ÷¶}FileDialog¡HThanks.

¦^´_ 1# maiko
  1. Option Explicit
  2. Sub OpenPath()
  3.     Dim fd As FileDialog, FileName As String, FileFolder As String
  4.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  5.     With fd
  6.         .AllowMultiSelect = False
  7.         Do
  8.             If .Show = True Then FileFolder = .SelectedItems(1)
  9.         Loop Until .SelectedItems.Count <> 0
  10.     End With
  11.     Set fd = Nothing
  12. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# maiko
¬°¤F¯à§PÂ_¬O§_¦³¿ï¾Ü¸ê®Æ§¨¡A³Ì¦n«ü©wInitialFileName
¦]¬°¹ï¸Ü¤è¶ô¬O­n¨ú±o¸ê®Æ§¨¥Ø¿ý¡A©Ò¥H·í§A¥¼¿ï¨ú¸ê®Æ§¨(¸ê®Æ§¨¦WºÙÄæ¦ì¬°ªÅ¥Õ)«ö¤U½T©w¡ASelectedItems.Count ¤´µM·|¬O1
  1. Sub OpenPath()
  2.     Dim fd As FileDialog, FileName As String, FileFolder As String, StartFolder$
  3.     Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  4.     StartFolder = "C:\Windows"  '¦Û¦æ­×§ï¹ï¸Ü¤è¶ôªº¹w³]¸ê®Æ§¨¥Ø¿ý
  5.     With fd
  6.         .AllowMultiSelect = False
  7.         Do
  8.         '.InitialFileName = StartFolder '¹w³]¹ï¸Ü¤è¶ô¶}±Ò¦bC:\Windows\¸ê®Æ§¨¦WºÙÅã¥ÜWindows
  9.         .InitialFileName = StartFolder & IIf(Right(StartFolder, 1) = "\", "", "\") '¹w³]¹ï¸Ü¤è¶ô¸ê®Æ§¨¦WºÙ¬°ªÅ¥Õ
  10.         .Show
  11.         If .SelectedItems.Count = 1 Then FileFolder = .SelectedItems(1)
  12.         Loop Until FileFolder <> StartFolder And .SelectedItems.Count = 1
  13.     End With
  14.     Set fd = Nothing
  15. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁ¨â¦ì«ü±Ð¡A¨â¦ìªº¥N½X¤@¼Ë¥i¥H¥Î¨ì¡A¥u¬OHsieh¤jªº¥N½X¦pªG¤£¿ïªº¸Ü¡A·|¤@ª½³£¦bInitialFileNameªº¦ì¸m¡A¨C¦¸³£­n­«·s¿ï¨ú·s¦ì¸m¡A¤£¬O®Ú¾Ú¤§«eªº°O¿ý¨Ó¿ï¨ú¡A©Ò¥H¤ñ¸û³Â·Ð¤@ÂI¡A¤£¹LÁÙ¬O¥i¥H¥Îªº°Õ¡IÁÂÁ¡I

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD