VBA - Image Control question

S

Steve Rindsberg

Has anyone tried dynamically loading images into image controls in various
versions of PPT?

I'm working on a VBA form that includes one.

In PPT Windows (any version) and Mac PPT 2004, I can load a picture into the
control thus:

Me.Image1.Picture = LoadPicture("Macintosh HD:Blah:Blah:picture.bmp")

Problem is that in Mac PPT X the same code won't compile.

Instead I get:

"Function or interface is marked as restricted or the function uses an
automation type not supported in Visual Basic."

At that point, LoadPicture is highlighted, indicating that it's the source of
Compiler Distress. PPT X VBA Help says it should work.

Compiler hasn't read Help, I guess.

Clues, anyone?


================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
J

Jim Gordon MVP

Hi Steve,

Heck, I couldn't even get it to work in PowerPoint 2004. All I got was
"object required" for bmp, and "invalid picture" for other picture types.

-Jim



Has anyone tried dynamically loading images into image controls in various
versions of PPT?

I'm working on a VBA form that includes one.

In PPT Windows (any version) and Mac PPT 2004, I can load a picture into the
control thus:

Me.Image1.Picture = LoadPicture("Macintosh HD:Blah:Blah:picture.bmp")

Problem is that in Mac PPT X the same code won't compile.

Instead I get:

"Function or interface is marked as restricted or the function uses an
automation type not supported in Visual Basic."

At that point, LoadPicture is highlighted, indicating that it's the source of
Compiler Distress. PPT X VBA Help says it should work.

Compiler hasn't read Help, I guess.

Clues, anyone?


================================================
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 
S

Steve Rindsberg

Jim Gordon MVP said:
Hi Steve,

Heck, I couldn't even get it to work in PowerPoint 2004. All I got was
"object required" for bmp, and "invalid picture" for other picture types.

One thing I've noticed: the UI does a nice job of hiding the case-sensitivity of
the underlying unix from the user. VBA doesn't. ISTR that I got some of those
kind of errors and made them go 'way by making sure to specify a filename using
the *exact* capitalization as the file itself displayed on the file system.

If that doesn't fix it, let me know and I'll cobble up a little bit of code to
send you.

Help claims it works with all kinds of file types but it seems to be wrong. PICT
files worked here as well. JPGs and PNGs didn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top