Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2005, 02:18 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default LoadPicture

Hi,

I am trying to load a picture as background of an imagebox, using the following code:

sht1.OLEObjects("Image1").Picture = LoadPicture(filepath)

Unfortunately, I get an error using this statement. sht1 is a function, which represents Workbooks(1).Sheets(1)

Hoping you have a solution

-Max-
 
Old April 19th, 2005, 12:52 AM
Authorized User
 
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can not use Sht1 as a variable object. The syntax should be:
x=1
y=1
workbooks(x).sheets(y).OLEObjects("Image1").Pictur e = LoadPicture(filepath)











Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.