ļ·() 'VB6.0VBAVB.netVSTOͨ

Sub ļ·() 'VB6.0VBAVSTOͨáҪãҪؼ
 
    On Error Resume Next '(Error)룬Զһ
    Dim s As String
    Dim obMapp As Object
  
    Dim My_Path As String
            
    'Ĭѡϵͳġûļ
    'Set obMapp = CreateObject("Shell.Application").BrowseForFolder(0, "ѡļڵļУ", &H1)  
     
     'Ĭѡǡ桿ļ
     Set obMapp = CreateObject("Shell.Application").BrowseForFolder(0, "ѡļڵļУ", 0, 0)  
    
    'ĬѡǡD:\
    'Set obMapp = CreateObject("Shell.Application").BrowseForFolder(0, "ѡļڵļУ", 0, "D:\")  

    'obMapp = CreateObject("Shell.Application").BrowseForFolder(0, "ѡļļУ", &H1) 'VSTOҪVBAеSetȥ
  
      
    If Not obMapp Is Nothing Then
        My_Path = obMapp.Self.Path
        MsgBox My_Path, , "ѡͼƬļ1"
        If Not My_Path Like "*\" Then My_Path = My_Path & "\" '·βûС\ͼ
        MsgBox My_Path, , "ѡͼƬļ2"
    Else
        MsgBox "ûѡļļУѡ", 16, ""
        Exit Sub
    End If
     
    
    If obMapp Is Nothing Then Exit Sub 'ûѡ˳
    If Strings.Right(obMapp.Self.Path, 1) <> "\" Then
        My_Path = obMapp.Self.Path & "\"   'ѡǸĿ¼̷ʱpathβС\ʹʱע⣺βѾС\ һ\
    Else
        My_Path = obMapp.Self.Path
    End If
     
    
    'ȡ·βС\
    MsgBox My_Path, , "ѡͼƬļ1"
    MsgBox My_Path, vbInformation, "ѡļļ2"
    
    's = Dir(My_Path & "*.xls*")
     'MsgBox s  'ֻͨѡļָ͵һļļڣͷΪ
    'If s = "" Then MsgBox "ѡļûдļ", 16, "ϵͳ"
    
End Sub 