I am trying to Open a Windows Installer database file using VB6.
I have included the refrences "Windows Installer Object Library" (msi.dll)

when I run the following code

Dim objWI As WindowsInstaller.Installer
Dim objDB As WindowsInstaller.Database
Set objDB = objWI.OpenDatabase("[pathof msi]",0)

I get an error saying "Object variable or With block variable not set ".

What could be the mistake on my part???

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


I think you have to set the objects.

Dim objWI
Dim objDB
Dim Database

Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1

Set objWI = Createobject("WindowsInstaller.Installer")
Set objDB = Createobject("WindowsInstaller.Database")

Set Database = objWI.OpenDatabase("pathtomsi",msiOpenDatabaseModeTransact)

This at least works in my scripts.
Answered 07/11/2005 by: TomB
Orange Belt

Please log in to comment