2011年5月19日木曜日

Excel VBA ファイル出力


参照設定でMicrosoft Scripting Runtimeを設定した場合

Dim FSO As New FileSystemObject
Dim TS As TextStream
 
Set TS = FSO.CreateTextFile("c:\a.txt")
TS.WriteLine "文字を出力"
TS.Close
Set TS = Nothing
Set FSO = Nothing



参照設定をしない場合

Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
 
Set TS = FSO.CreateTextFile("c:\a2.txt")
TS.WriteLine "文字を出力"
TS.Close
Set TS = Nothing
Set FSO = Nothing

0 件のコメント:

コメントを投稿