Opening an embedded file through VBA

yussi1870

Board Regular
Joined
Mar 18, 2002
Messages
139
Office Version
  1. 365
Platform
  1. Windows
I have a number of embedded files in my worksheet including word doc's and ppt doc's. I have embedded them using the following method:

Insert > Object > Create From File > [File] > Display as Icon > OK

I will be sending this spreadsheet out to others whose only access to these files will be through the macro on this spreadsheet. Depending on what command buttons the user clicks I want the corresponding embedded file to open. Any ideas on how to write this in VBA?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
On 2002-05-30 04:38, yussi1870 wrote:
I have a number of embedded files in my worksheet including word doc's and ppt doc's. I have embedded them using the following method:

Insert > Object > Create From File > [File] > Display as Icon > OK

I will be sending this spreadsheet out to others whose only access to these files will be through the macro on this spreadsheet. Depending on what command buttons the user clicks I want the corresponding embedded file to open. Any ideas on how to write this in VBA?

Yes this is possible.
All you need do is make a note of the Objects
index OR just rename it in the Names box and
then reference it....key here being the Action Verb....see below for ideas.

<pre/>
Sub ActivateObj()
'// Opens object
Dim oEmbFile As Object
Application.DisplayAlerts = False

'// Either reference the OLEObject by index
'// or by name if you Name the Object
'// Note:
'// Sheets(2) substitute with your Sheet
Set oEmbFile = ThisWorkbook.Sheets(2).OLEObjects(2)
oEmbFile.Verb Verb:=xlPrimary
Set oEmbFile = Nothing

Application.DisplayAlerts = True

End Sub
</pre>
 

Quest

New Member
Joined
Dec 15, 2003
Messages
3
Hi Ivan,
i seem to be stuck with a similar problem...

have sent you an email for the same. Please can you help me.
thanks,
Quest
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,480
Messages
5,770,330
Members
425,612
Latest member
martinijr

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