Either I get the message:
Run-time error '91': Object variable or with block variable not set
or when I change the way to declare the object:
Run-time error '429': ActiveX component can't create object
In Excel VBA Tools > References I added ImageMagickObject.dll which is nicely shown as ImageMagickObject 1.0 Type Library. I can also see the VBA editor can read the DLL, because when I type "Dim img as Ima", then to automatic completion offers the ImageMagickObject as an option and later when I hit "." then MagickImage is also available for auto completion.
I am running Windows 7 64bit with Office 2010 32bit. Initially I installed the default 64bit dynamic version of ImageMagick, as a test I installed the 32bit static 16 version (6.8.7-q16), also didn't work.
The Error 91 I get when I run below code(breaks at 'msg = img.Convert'):
Code: Select all
Sub sbExample1()
Dim img As ImageMagickObject.MagickImage
Dim SourceFile As String, DestFile As String
Dim msg
SourceFile = "something.jpg"
DestFile = "something.jpg"
msg = img.Convert(SourceFile, DestFile)
Debug.Print msg
Set img = Nothing
End Sub
Code: Select all
Dim img As Object
Set img = CreateObject("ImageMagickObject.MagickImage.1")
Code: Select all
Dim img As ImageMagickObject.MagickImage
I also tried to run SimpleTest.vbs which is in the tests folder of ImageMagickObject and I get error: 424 Object Required.
It is clear that something is blocking me from accessing this object, but I can't figure out what it is.
Anybody any ideas?