If I well understand your device is the Agilent 4396B Network/Spectrum/Impedance Analyzer
You can find the device’s GPIB Programming Guide here :
Inside you can find some code to help you.
But before to execute any code lines you need to load the correct GPIB driver from your autost program (LOAD BIN “HPIBS;DEV gpib1 ISC 7”) or from the HTBasic menu : Tools\Device setup\Add\HPIBS + GPIB parameters
See your Keysight Connection Expert software scan for the correct parameters setup : gpib1 and 7 (?)
This first part is clear for you ?
If not, you could try to post some screenshot of your configuration here for verification (probably through images hosting site)