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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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
Back
Top