アットウィキロゴ

VBAメモ

同一フォルダ内にファイルを書き込む方法

Sub CommandButton1_Click()
   '--------------------------------------------------------------'
   'ファイルを開く
   '--------------------------------------------------------------'
   Dim constFile
       constFile = ThisWorkbook.Path & "\" & "コメント抽出.txt"     '定数ファイル
       fileNumConst = FreeFile                               '
       Open constFile For Output As #fileNumConst            'オープン
       
       
       LastRow = Range("a65536").End(xlUp).Row
       StartRow = 2
       
       Do While StartRow <= LastRow
       
           Value = Trim(Cells(StartRow, 1))
           Count = InStr(Value, "//")
           If 0 < InStr(Value, "//") Then
            Print #fileNumConst, Value
           End If
       StartRow = StartRow + 1
       Loop
       

       Close #fileNumConst
最終更新:2008年06月06日 17:39