Is there way to debug Office convert task addin

Hello comrades, I tried to modify standard Excel to PDF Task and I faced an unexpected error. I am trying to get PDM variable value. I can't get  value because program failed and throw exception: GetvariableValue error HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH). Exception throw on line 4 100%.

Dim File As Object
Dim Folder As Object
MsgBox (Vault.Name)
File = vault.GetFileFromPath(FilePath, Folder)
MsgBox ("File ")‍‍‍‍‍‍

Now I'm trying to understand where the program failing by putting message boxes. But they can't tell me why I received a type mismatch error.

So I have two questions:

  1. Is there an adequate way to debug Office task addin.
  2. And does somebody have an idea why that exception keeps throwing?
SolidworksSolidworks Pdm/enterprise Pdm