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

[µo°Ý] ¦p¦ó¨ú±o¤w¸g¦³ªºFolderBrowserDialog­È

[µo°Ý] ¦p¦ó¨ú±o¤w¸g¦³ªºFolderBrowserDialog­È

¥»©«³Ì«á¥Ñ z15935712 ©ó 2014-8-21 12:38 ½s¿è

«e¨¥:button1¬OÂsÄý¸ê®Æ§¨¸ô®|¦ì¸mªº¥\¯à
          button2¬O¶}°_button1¿ï¨ú¦n¸ê®Æ§¨¸ô®|©³¤UªºexcelÀÉ
·Q½Ð°Ý°ª¤â­Ì
§ÚButton1¤w¸g¥i¥HÂsÄý¸ê®Æ§¨ªº¸ô®|¤F¡A¨º§Úbutton2¸Ó¦p¦ó¨ú±o¸ô®|¦ì¸mµM«á¥h¶}±Ò©³¤UªºexcelÀÉ
½Ð°ª¤â­Ì«üÂI°g¬z,·P®¦
  1. Public Class Form1



  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.         FolderBrowserDialog1.ShowDialog()
  4.         TextBox1.Text = FolderBrowserDialog1.SelectedPath
  5.     End Sub

  6.     Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

  7.     End Sub

  8.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  9.       
  10.     End Sub

  11.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  12.     End Sub
  13. End Class
½Æ»s¥N½X

¦^´_ 1# z15935712
¬JµM§A©ñ¨ìTextBox1¡A¦ó¤£±qTextBox1¨ú

TOP

¦^´_ 2# stillfish00

xlBook = xlApp.Workbooks.Open(TextBox1.Text)½Ð°Ý¤j¤j¬O³o¼Ë¤l¼g³Â,¥i¬O¨S¦³¤ÏÀ³

TOP

¦^´_ 2# stillfish00

xlBook = xlApp.Workbooks.Open(TextBox1.Text & "\" & "AA.xlsx")³o¼Ë¤l´N¦¨¥\¤F ÁÂÁ¤j¤jªº«üÂI°g¬z
¦ý¬O§Ú·Q­nªº¬O¶}±Ò³]©w¦n¸ô®|¤U©Ò¦³ªºexcel¤£¥u¤@­Ó¡A½Ð°ÝÀ³¸Ó«ç»ò°µ
ÁÂÁÂ

TOP

¦^´_ 4# z15935712
¥Î°j°é¶}±Ò¨C­ÓÀÉ®×

f = Dir(TextBox1 & "\*xls*")
Do Until f = ""
fs = TextBox1 & "\" & f
xlApp.Workbooks.Open fs
f = Dir
Loop
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# z15935712
Àɮרt²Îªº³B²z¥i¬d¸ßFileSystemObject§ä¨ì¬ÛÃö¸ê®Æ
©³¤U¤è¦¡¨Ñ°Ñ¦Ò:
  1.   Dim s, oFs, oFile
  2.   
  3.   s=TextBox1.Text
  4.   Set oFs = CreateObject("Scripting.FileSystemObject")
  5.   If oFs.FolderExists(s) Then
  6.     For Each oFile In oFs.GetFolder(s).Files  '©Ò¦³¸Ó¸ê®Æ§¨¤UÀÉ®×
  7.       If StrComp(Right(oFile.Path, Len(".xlsx")), ".xlsx") = 0 Then  '¦pªG¬O.xlsxÀÉ®×
  8.         'msgbox oFile.Path
  9.       End If
  10.     Next
  11.   End If
½Æ»s¥N½X

TOP

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2014/8/25 12:43): ¦³°ÝÃD¤W¶ÇÀÉ®×·|²M·¡¨Ç

¦^´_ 6# stillfish00
¤j¤j¥X²{¤U¦C¦¹°ÝÃD,¸Õ¤F«Ü¦h¤èªk¦ý©l²×µLªk¸Ñ¨M¡A§Æ±æ±z¯àÀ°§U...·P®¦

TOP

¦^´_ 7# z15935712
§A³o¤£¬OVBA§a...
VB.NET ???
¨S¦³Right¨ç¦¡¡A§A¦Û¤vÀ³¸Ó¦³¯à¤O§äVB.NET¤Uªº¦r¦ê¨ç¦¡¨Ó¥Î

TOP

¦^´_ 8# stillfish00
·PÁ¤j¤j´£ÂI.À´¤F

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD