AnsweredAssumed Answered

GPIBコマンドでExcellのVBAを使用出来ない (Cannot use Excel VBA with GPIB commands)

Question asked by motoshoji on Jan 13, 2020

Interactive IO では GPIB コマンドを送れますが ExcellのVBAではコマンドを実行できない。何かの解決方法がありますか?

I can send {GPIB} command in Interactive IO, but I cannot execute the command in Excel VBA. Is there any solution?


Interactive IOが実行できる為にEOL Sequenceを設定します。下記の図の通りです。

Set EOL Sequence to execute Interactive IO. It is as the following figure.

Interactive IOを実行するために EOL SEQUENCEを設定します。図の通りです。

次にGPIBコマンドを実行します。このケースではSIGNAL GENERATORの出力レベルを設定します。

Next, execute the GPIB command. In this case, set the output level of the SIGNAL GENERATOR.

コマンド AP50 というのは出力レベル50dBμVにする。

The command {AP50} sets the output level to 50 dBμV.


Command AP? Is a query to check the output level. (APOF is output OFF.)


Operation was confirmed as shown in the figure below.


上記のようにInteractive IOでは問題なくコマンドを実行出来ました。

As mentioned above, the command was executed without any problem in Interactive IO.


Next, the command was executed using Excell's VBA, but there was no response and the operation could not be confirmed.


* The output level was changed to 80dBμV.


The code is as follows.


Sub ボタン1_Click()
Dim RM As New VisaComLib.ResourceManager
Dim SMB As New VisaComLib.FormattedIO488
Set RM = New VisaComLib.ResourceManager
Set SMB = New VisaComLib.FormattedIO488
Dim SMBAddress As String '測定器をOpenにするときのAddressをエクセルから取得する際に使用

SMBAddress =1
Set SMB.IO = RM.Open("GPIB::" & SMBAddress &"::INSTR")

SMB.WriteString "*IDN? 0x0D0A"
idname = SMB.ReadString()
Range("G21") = idname
SMB.WriteString "AP80,APOF"

Set SMB = Nothing
Set RM = Nothing

End Sub



As a result of the execution, the output level remains at 50dBμV.




Do I need to modify anything to use Excell's VBA? Any advice please.