用EXCEL来控制CST 运行,出错了,怎么回事?
时间:10-02
整理:3721RD
点击:
参照example里提供的demo例子,自己试着写了一个:模型结构已经在CST里建好,主要是想修改激励源,来控制CST仿真。VBA语言如下:
Option Explicit
Sub mwsconnect()
' Next open a connection to CST DESIGN ENVIRONMENT
Dim studio As Object
Set studio = CreateObject("CSTStudio.Application")
' Now open the model file which is located in the same folder as the Excel sheet
' This will also return a connection to CST MICROWAVE STUDIO
Dim path As String
Dim fname As String
path = ActiveWorkbook.path
Dim mws As Object
Set mws = studio.OpenFile(path & "\lojiedigis1MHz_sinExcition.cst")
mws.DeleteResults
With mws.TimeSignal
.Reset
.Name "default"
.SignalType "Sine step"
.ProblemType "High Frequency"
.Ttotal "2"
.Phase "0.0"
.Frequency "1"
.RiseFactor "0.0001"
.Create
End With
mws.Rebuild
' Make a connection to the solver and start the simulation
mws.solver.Start
mws.Save
' Finally close the connection to CST MICROWAVE STUDIO
studio.Quit
Set studio = Nothing
End Sub
但是EXCEL 提示未找到文件!现在CST提供的demo例子也不知道被我改了什么也提示这个错误。上面的VBA有错吗?还有那个EXCEL提示未找到文件是原因啊?谢谢!
还有在按EXCEL里的VBA保存时,经常提示如下错误。这是为什么啊?谢谢!
Option Explicit
Sub mwsconnect()
' Next open a connection to CST DESIGN ENVIRONMENT
Dim studio As Object
Set studio = CreateObject("CSTStudio.Application")
' Now open the model file which is located in the same folder as the Excel sheet
' This will also return a connection to CST MICROWAVE STUDIO
Dim path As String
Dim fname As String
path = ActiveWorkbook.path
Dim mws As Object
Set mws = studio.OpenFile(path & "\lojiedigis1MHz_sinExcition.cst")
mws.DeleteResults
With mws.TimeSignal
.Reset
.Name "default"
.SignalType "Sine step"
.ProblemType "High Frequency"
.Ttotal "2"
.Phase "0.0"
.Frequency "1"
.RiseFactor "0.0001"
.Create
End With
mws.Rebuild
' Make a connection to the solver and start the simulation
mws.solver.Start
mws.Save
' Finally close the connection to CST MICROWAVE STUDIO
studio.Quit
Set studio = Nothing
End Sub
但是EXCEL 提示未找到文件!现在CST提供的demo例子也不知道被我改了什么也提示这个错误。上面的VBA有错吗?还有那个EXCEL提示未找到文件是原因啊?谢谢!
还有在按EXCEL里的VBA保存时,经常提示如下错误。这是为什么啊?谢谢!