1. 编写测试EXCEL,格式如图所示:
2. 修改脚本,指定excel所在路径及文件名
3. 打开PowerDesigner,创建物理模型(Physical Data Model)
4. 在PowerDesigner菜单栏中,依次点击“Tools ->Excute Commands->Edit/Run Script..”
'******************************************************************************
Option Explicit
Dim mdl ' the current model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no Active Model"
End If
Dim HaveExcel
Dim RQ
RQ = vbYes 'MsgBox("Is Excel Installed on your machine ?", vbYesNo + vbInformation, "Confirmation")
If RQ = vbYes Then
HaveExcel = True
' Open & Create Excel Document
Dim x1 '
Set x1 = CreateObject("Excel.Application")
x1.Workbooks.Open "d:\111.xlsx" '指定excel文档路径
x1.Workbooks(1).Works