ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [VBA] 텍스트파일에 쓰기, 읽기
    자기계발/엑셀, VBA 2022. 7. 30. 18:41
    728x90

     

     

     

    Private Function fCtrlFile()
        Set wb = ActiveWorkbook 'ThisWorkbook'
        Set sht = ActiveSheet
    
        Dim file_name As String
        file_name = wb.path & "\Text.txt"
        
        'workbook.Open Filename:=workbook.path & "Text.txt
        'FileOpen( 1, file_name, OpenMode.Input)
        Open file_name For Input As #1
        
        Dim textline1 As String
        Dim textline2 As String
        
        textline2 = "가나다라"
        
        
        
        Line Input #1, textline1 '읽기
        MsgBox textline1
        Close #1
        
        Open file_name For Output As #1
        Print #1, textline2 '쓰기
        Close #1
        
    End Function
    728x90

    '자기계발 > 엑셀, VBA' 카테고리의 다른 글

    Excel VBA - 파일입출력  (0) 2022.03.04
Designed by Tistory.