Reference Excel Chart in Access Unbound Object Frame using Sourceitem property

I can't for the life of me figure out to reference an Excel chart in my Access form Unbound Object Frame using the "Sourceitem" property. I need to embed multiple charts (not just pictures of the chart)into my Access form using the OLE Unbound Object Frame. I have the "SourceDoc" property correct as this is just the filepath to my Excel file. However I can't seem to reference the specific charts on the worksheets (Which are seperate chart sheets from the actual data). Attached is an example of the non-workng code. It currently returns only the active cells in the worksheet. I've been struggling with this for days !!! Thanks.

*The Excel File Name = Spend Management 7-19-2010.xlsx
*The Worksheet(Chart Sheet) Name = Direct-Charts
*Chart Name = Chart 35
With dtb

'.Visible = True
     ' Enable control.
     '.Enabled = True
     ' Set Locked property to False.
     '.Locked = False
     ' Allow embedded objects only.
     '.OLETypeAllowed = acOLEEmbedded
     ' Specify the OLE server and the type of object.
     '.Class = "Excel.Chart.8"
     ' Specify the file to be embedded.
     '.SourceDoc = "G:\000_Supply Chain\Procurement-Corporate\Spend Management\Spend Management 7-19-2010.xlsx"
     ' Specify the Worksheet Item
     '.SourceItem = "Direct - Charts![Spend Management 7-19-2010.xlsx].Chart 35"
     ' Create the embedded object.
     '.Action = acOLECreateEmbed
 ' End With

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Have you tried simply copying the Excel chart, then on the Access form, Select:
Paste Special-->Microsoft Office Excel Chart?

This works fine for me...


RichBLACKIIIAuthor Commented:
No, that's not going to work. I have multiple charts that need to be loaded into the same unbound object frame at different times when I run a different macro through command buttons on my form.

Gosh, I didn't think this question would be this hard ???...I guess it must be if google couldn't provide an answer :\

Although it says worksheet, it is actually a workbook.  You have to start from there.  What is the workbook(sheet) name?
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

RichBLACKIIIAuthor Commented:
*The Excel File Name = Spend Management 7-19-2010.xlsx
*The Worksheet(Chart Sheet) Name = Direct-Charts
*Chart Name = Chart 35

I have this in the question already.
Kevin CrossChief Technology OfficerCommented:
I believe your issue to be here:

.SourceItem = "Direct - Charts![Spend Management 7-19-2010.xlsx].Chart 35"

Since the names have spaces in them, I believe you will want to surround them with []. But as I believe was GrayL's point here - http:#a33442720 - you will want to start with the Excel sheet name.

.SourceItem = "[Direct - Charts]![Chart 35]"
.SourceItem = "[Direct - Charts].[Chart 35]"

You are already opening the Excel workbook as the source document.
RichBLACKIIIAuthor Commented:
SourceItem = "[Direct - Charts]![Chart 35]"
.SourceItem = "[Direct - Charts].[Chart 35]"

The syntax you gave is still incorrect. The Excel file opens but just embeds the active workbook cells.
Open the form in design view, display Properties, click Data tab, click SourceItem, press F1 and you get a detailed explanation of how to reference the elements in Excel.
RichBLACKIIIAuthor Commented:
Yes, GRayL I know how to use the Sourceitem property. The exact problem I am having is how to reference an Excel Chart on a Excel Chart Sheet. The help menu does not give the syntax for that situation.
Kevin CrossChief Technology OfficerCommented:
VBA > Worksheets("{sheetname}").ChartObjects(n).Chart
RichBLACKIIIAuthor Commented:
VBA > Worksheets("{sheetname}").ChartObjects(n).Chart

This does not work with the sourceitem property.
I got from the Help extract that the SourceItem had to be a cell or cell range.  ie.  It could not be a chart.
In this thread, the syntax is slightly differenet
Of course, there it's referring to a sheet embedded chart, maybe wort a try to place the Chart in a worksheet and do it this way?

Also here, it is mentioned to be working I believe

Have you tried much shorter statements?

'.SourceItem = "Direct - Charts"
(eventually wit [] or '   ' around them?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kevin CrossChief Technology OfficerCommented:
Think GrayL is right here: http:#a33524927
RichBLACKIIIAuthor Commented:
It's close enough
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.