Visual Basic Automation Error "Object reference not set to an instance"

Hello,

I'm new to VB and Passolo automation and I'm already stuck at the first code lines. I'm working on an app, which should update the Source stringLists of a specific bundle with a button. I believe I have an empty variable and I can't find much online when not related to Passolo macro. Below is my form:

Imports PassoloU

Public Class Form1

Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
Dim PSL As PassoloApp
Dim myBundle As PslProject

PSL = CreateObject("Passolo.Application")
myBundle = PSL.Projects.Open("C:\Test\Bundle.lpu")

MessageBox.Show("Number of active projects: " & PSL.Projects.Count)

MessageBox.Show("Number of source files: " & myBundle.SourceLists.Count)

myBundle.UpdateSourceLists()

End Sub

End Class

I have an error message "Object reference not set to an instance" wherever I try to use the variable myBundle. It seems to be empty. When adding a message box to see how many projects were opened, I got 0. 

Can anyone help me?

emoji
Parents Reply Children
No Data