Insert a bmp file

Jeff Barnes

New Member
Joined
Sep 12, 2006
Messages
12
Hi,

I have an application that uses excel to generate the reports.
What I need to ba able to do is have excel insert a bmp image when the file is opened.

The image in the bmp file will change depending on the user but the file name will stay the same.

Is there any way of doing this?

I wanted to do something like =File("\MyDir\MyBmp.bmp") or what ever will work.


Thanks,

Jeff
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi, Jeff Barnes
Welcome to the Board !!!!!

you could record a macro to get the syntax
menu tools/macro/record macro

actions to do
menu insert / picture / from file
etcetera

stop recording

check the code
Code:
    ActiveSheet.Pictures.Insert("C:\WINDOWS\Desktop\home.jpg").Select
1. you don't need the "selection" (so deleted ".Select"
2. perhaps you need a specific location
Code:
Range("B5").Select
ActiveSheet.Pictures.Insert ("C:\WINDOWS\Desktop\home.jpg")
there are more "professional" ways to do this ... but this could well be just what you need

kind regards,
Erik
 

Jeff Barnes

New Member
Joined
Sep 12, 2006
Messages
12
Hi Erik,

Using your idea I was able to add the following code to my program and it does exactly what I need.

oSheet:Range("A1","A1"):Select()
oSheet:Pictures:Insert( cFile )


Thanks for the fast reply,

Jeff
 

Forum statistics

Threads
1,137,330
Messages
5,680,857
Members
419,936
Latest member
rphill48

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top