---------1.读txt文件写入WinCC变量代码
Dim CDG,FSO,F
Set CDG=CreateObject("MSCOMDLG.CommonDialog.1")
Set FSO=CreateObject("s cripting.FileSystemObject")
CDG.MaxFileSize=260
CDG.InitDir="C:\" ‘初始路径
CDG.Filter="txt Files*.txt"
CDG.ShowOpen
Set F=FSO.OpenTextFile(CDG.FileName,1)
HMIRuntime.Tags("TagName").Write F.ReadAll
Set F=Nothing
Set FSO=Nothing
Set CDG=Nothing
2.WinCC变量写入txt文件代码
Dim CDG,FSO,F
Set CDG=CreateObject("MSCOMDLG.CommonDialog.1")
Set FSO=CreateObject("s cripting.FileSystemObject")
CDG.MaxFileSize=260
CDG.InitDir="C:\" ‘初始路径
CDG.Filter="txt Files*.txt"
CDG.ShowSave
Set F=FSO.OpenTextFile(CDG.FileName,2,1)
F.Write HMIRuntime.Tags("TagName").Read
Set F=Nothing
Set FSO=Nothing
Set CDG=Nothing