Read text file line by line using VBA on MAC

I want to read text file line by line using VBA on MAC OS 
Answer
Answer

Sub ReadTextFile()

    Dim FileNum As Integer

    Dim DataLine As String, MYPath As String

    

    MYPath = MacScript("return (path to desktop folder) as String")

    MYPath = MYPath & "MyFile.txt"

    

    FileNum = FreeFile()

    Open MYPath For Input As #FileNum

    

    While Not EOF(FileNum)

        Line Input #FileNum, DataLine ' read in data 1 line at a time

        Debug.Print DataLine

    Wend

End Sub

Hope this helps

________________________________
Richard V. Michaels
info@greatcirclelearning.com
Provides free AuthorTec add-ins for Mac & Win-Office. Site: greatcirclelearning.com

5 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated January 2, 2021 Views 1,825 Applies to: