加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

WINCC7.5SP2VBA编程9-创建画面

(2024-10-08 20:29:20)
标签:

西门子

wincc

vba编程

创建画面

分类: 西门子软硬件
这个练习使用VBA脚本判断某个名字的页面是不是存在,如果不存在就创建,并且设置长宽尺寸。
在WINCC VBA编辑器写下面的脚本:
Sub CreateHMIPage()
 Dim HMIPage, i, exist
 exist = 0
 For i = 1 To Application.Documents.count
    If Application.Documents.Item(i).Name = "VBAPage10" Then
        exist = 1
    End If
 Next
 If exist = 0 Then
    Set HMIPage = Application.Documents.Add(hmiOpenDocumentTypeVisible)
    HMIPage.Width = 1920
    HMIPage.Height = 1080
    HMIPage.SaveAs ("VBAPage10")
 End If
 End Sub
运行这个脚本,就可以创建画面了

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有