Code:
Sub DDL変換_Click()
Call ReplaceFromFile("C:\Users\PC533\Desktop\03_DDL変換ツール\INPUT\801_MKYT_GYOMBI.sql")
End Sub
Public Function ReplaceFromFile(FileName As String)
Dim FSO As FileSystemObject 'ファイルシステムオブジェクト
Dim Txt As TextStream 'テキストストリームオブジェクト
Dim buf_strTxt As String '読み込みバッファ
On Error GoTo Func_Err:
'オブジェクト作成
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Txt = FSO.OpenTextFile(FileName, ForReading)
'全文読み込み
buf_strTxt = Txt.ReadAll
Txt.Close
'元ファイルをリネームして、テンポラリファイル作成
Name FileName As FileName & "_"
'置換処理
buf_strTxt = Replace(buf_strTxt, "NUMBER", "NUMERIC", , , vbBinaryCompare)
buf_strTxt = Replace(buf_strTxt, "NVARCHAR2", "VARCHAR", , , vbBinaryCompare)
buf_strTxt = Replace(buf_strTxt, "VARCHAR2", "VARCHAR", , , vbBinaryCompare)
buf_strTxt = Replace(buf_strTxt, "CLOB", "TEXT", , , vbBinaryCompare)
'書込み用テキストファイル作成
Set Txt = FSO.CreateTextFile(FileName, True)
'書込み
Txt.Write buf_strTxt
Txt.Close
'テンポラリファイルを削除
FSO.DeleteFile FileName & "_"
'終了処理
Func_Exit:
Set Txt = Nothing
Set FSO = Nothing
Exit Function
Func_Err:
MsgBox "Error Number : " & Err.Number & vbCrLf & Err.Description
GoTo Func_Exit:
End Function
\\\
from the given code now i want to modify as, it shld automatically take mul I/Pfile from fldr﹠the resultant O/Pfile shld be stored destined fldr.
Last edited by a moderator: