reading entire text file using vba

前端 未结 8 1270
暗喜
暗喜 2020-12-06 11:03

I\'m trying to read a text file using vba. I tried the below code

Open \"C:\\tester.txt\" For Input As #1
Worksheets(\"UI\").Range(\"H12\").Value = Input$(LO         


        
8条回答
  •  天命终不由人
    2020-12-06 11:19

    More Slightly modified for those who do not like VBA to have to make up explicit variables and then waste time transfer data to them.. Let With. do the job

    Function LoadFileStr$(FN$)
    
      With CreateObject("Scripting.FileSystemObject")
    
              LoadFileStr = .OpenTextFile(FN, 1).readall
    
            End With
    
    End Function
    

提交回复
热议问题