首页 > 编程语言 > 详细

VBA读取文件

时间:2015-05-29 19:41:36      阅读:312      评论:0      收藏:0      [点我收藏+]

Dim Foldar As String
Private Sub btn(ByVal Target As Range)
    If Target.Row = 1 And Target.Column = 1 Then
     Search
    End If
End Sub

 

Sub Search()
    With Application.FileDialog(msoFileDialogFolderPicker)
        If .Show = True Then
            Foldar = .SelectedItems(1)
            ‘Range("D3").Value = Foldar
            selectjs (Foldar)
        End If
    End With
End Sub

 

 

Public Function selectjs(ByVal lujing As String)

    Dim MyFile As String

    Dim s As String     

   Dim i As Integer    

MyFile = Dir(lujing & "\" & "*.js")    

count = count + 1    

s = MyFile   

  output (s)     Do While MyFile <> ""      

   MyFile = Dir                

If MyFile = "" Then        

count = 0             Exit Do

        End If      

           count = count + 1     

        s = MyFile      

   output (s)    

Loop    

Debug.Print s

End Function

 

 

 

Public Function output(sname)

Range("A" & count).Value = sname

End Function

VBA读取文件

原文:http://www.cnblogs.com/dzh1990/p/4539070.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!