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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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>
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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