Page 1 of 1

Using Identify in VBA

Posted: 2009-01-27T19:12:43-07:00
by oddball508
Does anyone have any ideas on why this code does not work? Doing this by command line works. I have the current version of IM loaded and set in the references.

Dim imgobj As MagickImage
Dim strDPI As String
Dim strFile As String

strFile = "J:\RCTAPE\AWM4\Jpeg\26\9\19\0001.jpg"

Set imgobj = New MagickImage
strDPI = imgobj.Identify("-format", "%x", strFile)
Set imgobj = Nothing

Re: Using Identify in VBA

Posted: 2009-01-27T19:54:05-07:00
by el_supremo
Does anyone have any ideas on why this code does not work?
It might help if you'd said what it was doing wrong. Error message? Nothing at all?

However, if this was C, I would say that you have to escape the backslashes in the filename string:

Code: Select all

strFile = "J:\\RCTAPE\\AWM4\\Jpeg\\26\\9\\19\\0001.jpg"
I'm not certain but I think Basic needs the same thing.

Pete

Re: Using Identify in VBA

Posted: 2009-01-27T21:30:24-07:00
by oddball508
Thanks - good point on the error message. It was a run-time error of "operating system exception". But the problem looks like it is in the current vertion of IM (ImageMagick-6.4.8-9-Q8-windows-dll). I rolled back to version 6.4.0-6-Q8 and it works perfectly.

Re: Using Identify in VBA

Posted: 2009-01-28T07:24:56-07:00
by magick
Install the Microsoft Visual C++ 2008 Redistributable Package. That will most likely solve your problem.

Re: Using Identify in VBA

Posted: 2009-01-28T15:56:51-07:00
by oddball508
Thanks - I'll try that one later. But why would installing the Microsoft Visual C++ 2008 Redistributable Package help with a VBA utilisation?