Embedding a file in Excel

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I have seen how to make a .wav, .gif, .swf, etc. In order to access these files though, they have to be present on the computer somewhere. The difficulty is when I send the spreadsheet to someone else, they don't have the files in the same location. Is there a way to just embed .wav, .gif etc inside of a spreadsheet? Does this make sense?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
The problem with that is once I have the object/file inserted (embedded) into one of my spreadsheets, I need to be able to reference it in the properties of a VBA object.

For instance.....if I insert a .bmp image onto a spreadsheet, I need to be able to click on the PICTURE property in a VBA UserForm and select THAT bitmap.
 
Upvote 0
Boy, that seems like a reasonable thing to be able to do, but I couldn't figure out how to do it.

A possible way would be to have your code activate the contents of an embedded object, and then save it to your hard drive with a defined path and file name. Then, have assign the file name to the properties, as you suggest. That all seems a bit convoluted, though. And dealing with the other app in VBA could be problematic.

There has to be an easier way.
Tom
 
Upvote 0
Basically, I want to be able to create a workbook that plays a sound file when it opens, however, the sound file will not be resident on the user's computer. I want to be able to embed the sound file into the workbook so that no matter who I give the workbook to, the sound file is there. I also plan on doing this with .swf, .dat, and .doc files too.
 
Upvote 0
Well, here's one way...
I embedded a WAV object on sheet one that happens to be called object 3. This'll play it, on opening the workbook:

Private Sub Workbook_Open()

Application.DisplayAlerts = False
ActiveSheet.Shapes("Object 3").Select
Selection.Verb Verb:=xlPrimary
Application.DisplayAlerts = True
End Sub

You could add a "Sheet1.Activate" to ensure that, if saved to sheet 3, say, it goes back to sheet one, where the object is.

I'm sure that, somewhere, there's a more elegant solution.

Tom
 
Upvote 0

Forum statistics

Threads
1,224,545
Messages
6,179,432
Members
452,915
Latest member
hannnahheileen

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