°»´ú"1.xls"ÀɬO§_§e¥´¶}ª¬ºA?
| ©«¤l2025 ¥DÃD13 ºëµØ0 ¿n¤À2053 ÂI¦W0  §@·~¨t²ÎWIN7 ³nÅ骩¥»Office2007 ¾\ŪÅv100 ©Ê§O¨k ¨Ó¦Û¥x¥_¥« µù¥U®É¶¡2011-3-2 ³Ì«áµn¿ý2024-3-14 
      
 | 
                
| ¦^´_ 4# Hsieh 
 ì¨Ó¥Î.Caption´N¥i¥H¨M¸Ñ¡A¤Ó·PÁ§A¤F
 | 
 | 
| {...} ªí¥Ü»Ýn¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡ | 
|  |  | 
|  |  | 
| ©«¤l2025 ¥DÃD13 ºëµØ0 ¿n¤À2053 ÂI¦W0  §@·~¨t²ÎWIN7 ³nÅ骩¥»Office2007 ¾\ŪÅv100 ©Ê§O¨k ¨Ó¦Û¥x¥_¥« µù¥U®É¶¡2011-3-2 ³Ì«áµn¿ý2024-3-14 
      
 | 
                
| ¦^´_ 9# yangjie 
 Function IsOpen() §Ú´ú¸Õ¬O¥i¥H°õ¦æ
 
 ¦ýÀɮצWºÙ¦³¤À¤j¤p¼g¡A¨Ò¦p Book1»PBOOK1´N·|§PÂ_¬°¤£¦P
 WINDOW¨t²ÎªºÀÉ®×À³¸Ó¬O¨S¦³¤À¤j¤p¼g(ÁöµMÅã¬O¦³¤j¤p¼g)
 | 
 | 
| {...} ªí¥Ü»Ýn¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡ | 
|  |  | 
|  |  | 
| ©«¤l258 ¥DÃD77 ºëµØ0 ¿n¤À385 ÂI¦W0  §@·~¨t²ÎWin7 ³nÅ骩¥»Office2010 ¾\ŪÅv20 ©Ê§O¨k ¨Ó¦ÛTaiwan µù¥U®É¶¡2010-8-8 ³Ì«áµn¿ý2021-1-25 
 | 
                
| ¦^´_ 4# Hsieh ÁÂÁÂHsiehª©¥D¨ó§Ufunction Isopen()ªº«ü¾É
 ¦ÛÓ¨àµy·L¦³ÂI¬ð¯}
 Sub ¿ï¾ÜÀɦW¶×¤J()
 Dim Path1, Str1 As String
 Dim wb As Workbook
 Path1 = Application.ActiveWorkbook.Path
 
 
 Dim Filt As String
 Dim FilterIndex As Integer
 Dim fileName As Variant
 Dim Title As String
 Filt = "Excel Files (*.xls),*.xls"
 FilterIndex = 5
 Title = "Select a File for Import"
 fileName = Application.GetOpenFilename _
 (FileFilter:=Filt, _
 FilterIndex:=FilterIndex, _
 Title:=Title)
 If fileName = False Then
 MsgBox "No file was selected."
 Exit Sub
 End If
 Dim fso3
 Set fso3 = CreateObject("Scripting.FileSystemObject")
 GetAn3 = fso3.GetbaseName(fileName)
 If IsOpen(GetAn3 & ".xls") <> False Then
 Workbooks(GetAn3 & ".xls").Activate
 Else
 Set wb = Workbooks.Open(fileName, True, False)
 End If
 f_bookname2 = ActiveWorkbook.Name
 Windows(f_bookname2).Activate
 Sheets(1).Activate
 end sub
 
 Function IsOpen(Fs As String) As Boolean
 IsOpen = False
 For Each w In Windows
 If w.Caption = Fs Then IsOpen = True: Exit For
 Next
 End Function
 ¦A½Ð±Ð¤j¤j
 1. ¦p¦óÅýApplication.GetOpenFilename ©Ò¶}¤§µøµ¡¬°path1?
 2.¥i¦³§ó¦nªº¼gªk?
 ÁÂÁÂ
 | 
 | 
|  | 
|  |  | 
|  |  | 
| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¦^´_ 13# yangjie ½Æ»s¥N½XOption Explicit
Sub ¿ï¾ÜÀɦW¶×¤J()
    Dim Path1, Str1 As String
    Dim wb As Workbook
    Dim Filt As String
    Dim FilterIndex As Integer
    Dim Title As String
    '---------------------------------
    Dim xlfileName As String, xlFullName As String
    'ק﫬ºA As String  xlfileName:¨S¦³¸ô®|
    Dim MyPath
    MyPath = CurDir    '¬ö¿ý즳ªº¥Ø¿ý©ÎÀÉ®×§¨¡C
    Path1 = Application.ActiveWorkbook.Path
   ' Path1 = "C:\WINDOWS\SYSTEM"
    ChDrive Split(Path1, ":")(0)    'ChDrive ³¯z¦¡ §ïÅܥثeªººÏºÐ¾÷¡C
    ChDir Path1                     'ChDir   ³¯z¦¡ §ïÅܥثeªº¥Ø¿ý©ÎÀÉ®×§¨¡C
    '½Ðª`·N ChDir ³¯z¦¡·|§ïÅܲ{¦³¥Ø¿ý¦ì¸m¡A¦ý¤£·|§ïÅܺϺо÷¦ì¸m¡A
    '¨Ò¦p¡A¦pªG²{¦bªººÏºÐ¾÷¬O C¡A³¯z¦¡±N²{¦³¥Ø¿ý¤Á´«¨ìºÏºÐ¾÷ D¡A¦ý¬O C ¤´µM¬O²{¦³ªººÏºÐ¾÷¦ì¸m¡G
    Filt = "Excel Files (*.xls),*.xls"
    FilterIndex = 5
    Title = "Select a File for Import"
    xlFullName = Application.GetOpenFilename _
        (FileFilter:=Filt, _
         FilterIndex:=FilterIndex, _
         Title:=Title)
    
    If UCase(xlFullName) = "FALSE" Then
        MsgBox "No file was selected."
        Exit Sub
    End If
    '''''''''''''''''''''''''
    ChDrive Split(MyPath, ":")(0)    '§ïÅܬ°ì¦³ªººÏºÐ¾÷¡C
    ChDir MyPath                     '§ïÅܬ°ì¦³ªº¥Ø¿ý©ÎÀÉ®×§¨¡C
    ''''''''''''''''''''''''''
    
    xlfileName = Split(xlFullName, "\")(UBound(Split(xlFullName, "\")))
    '°}¦C(¤W¤¸¯À¼Æ) ¨úªºÀɮצWºÙ¨S¦³¸ô®|
    If IsOpen(xlfileName) <> False Then
        Workbooks(xlfileName).Activate
    Else
        Set wb = Workbooks.Open(xlFullName, True, False)
    End If
    f_bookname2 = ActiveWorkbook.Name
    Windows(f_bookname2).Activate
    Sheets(1).Activate
End Sub
Function IsOpen(Fs As String) As Boolean
    IsOpen = False
    For Each W In Windows
         If W.Caption = Fs Then IsOpen = True: Exit For
   Next
End Function
 | 
 | 
|  | 
|  |  | 
|  |  | 
| ©«¤l258 ¥DÃD77 ºëµØ0 ¿n¤À385 ÂI¦W0  §@·~¨t²ÎWin7 ³nÅ骩¥»Office2010 ¾\ŪÅv20 ©Ê§O¨k ¨Ó¦ÛTaiwan µù¥U®É¶¡2010-8-8 ³Ì«áµn¿ý2021-1-25 
 | 
                
| ¦^´_ 14# GBKEE Á¤F
 if Ucase(filename)="FALSE" then
 »P
 if filename=False then
 ¥i¦³¬Û²§
 | 
 | 
|  | 
|  |  | 
|  |  | 
| ©«¤l258 ¥DÃD77 ºëµØ0 ¿n¤À385 ÂI¦W0  §@·~¨t²ÎWin7 ³nÅ骩¥»Office2010 ¾\ŪÅv20 ©Ê§O¨k ¨Ó¦ÛTaiwan µù¥U®É¶¡2010-8-8 ³Ì«áµn¿ý2021-1-25 
 |  | 
|  | 
|  |  | 
|  |  | 
| ©«¤l258 ¥DÃD77 ºëµØ0 ¿n¤À385 ÂI¦W0  §@·~¨t²ÎWin7 ³nÅ骩¥»Office2010 ¾\ŪÅv20 ©Ê§O¨k ¨Ó¦ÛTaiwan µù¥U®É¶¡2010-8-8 ³Ì«áµn¿ý2021-1-25 
 | 
                
| ¦^´_ 18# Hsieh 
 ÁÂÁ §¹¥þ¤F¸Ñ
 | 
 | 
|  | 
|  |  | 
|  |  |