3

I am using CADCAM Software and writing macro code. Here is my basic macro code.

OPEN "C:\Area ratio\etch.txt" FOR INPUT as #1
DO WHILE NOT EOF (1) =1
    LINE INPUT #1, REC$
    if REC$="" then goto jump2
    'PRINT REC$
    y2#=Y2#-200
    Addtext@ x2#,y2#,0,0,REC$
jump2:
LOOP
CLOSE #1
Clearmarkers@
end@

This code will be working fine. but it will read the text and print line by line.

I need to print read whole text file at once.

eoredson
  • 1,167
  • 2
  • 14
  • 29
News Dozens
  • 41
  • 2
  • 8

1 Answers1

7
Sub Test()

    'Tools -> References -> Microsoft Scripting Runtime
    Dim fso As New FileSystemObject
    Dim txt As TextStream
    Dim all_text As String

    Set txt = fso.OpenTextFile("c:\Temp\textfile.txt")
    all_text = txt.ReadAll
    txt.Close

End Sub
JohnyL
  • 6,894
  • 3
  • 22
  • 41
  • 1
    hi, @JohnyL I am sorry your code 100% working fine in excel VBA. but here I using the basic macro. I put them your code but it will show syntax errors. I need to macro code – News Dozens Dec 28 '17 at 06:15
  • 1
    @YowE3K Comment deleted! :) I was really confused until I watched editions. Watching changes is useful and cool thing! :) Happy New Year! :) – JohnyL Dec 29 '17 at 05:51