Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This worked in earlier versions. But my client has moved to Access 2010 and Windows 7 recently.

I'm creating a bar graph in an Excel file. Then I'm setting the source doc of an unbound object frame to that Excel file. This has worked perfectly for years and years and years.

But it's not working now so I'm rewriting the code. Nothing I find online seems to solve the problem.

Here's my code:

VB
With frm("oleHistogram")
     .OLETypeAllowed = acOLEEmbedded
     .Class = "Excel.Sheet"
     .SourceDoc = sUsersWindowsTempPath & sCapStudyTempFileForExcelHistogram
     .Action = acOLECreateEmbed
End With


Again, the oleHistogram object is an unbound object frame on a form. The variable "frm" is that form. The error occurs at .Action = acOLECreateEmbed. It is "The bound or unbound object frame you tried to edit does not contain an OLE object."

All the other code runs fine. And if I comment out the offending line, all runs error free but the report does not show the graph.

The form that contains the graph is a subform on a report. Again, this has worked perfectly for a dozen years. What I had previously done was to hard code the file name and path as a linked source doc in the unbound object frame. None of my code modified the ole object. I simply would recreate the xls file on the drive before running the report. But that was not working at all in the new environment. So I had to go the above route which according to my research should work.

Thanks :)
Posted
Updated 16-Jun-14 4:51am
v2

1 solution

Never mind on this issue. I bailed on it completely. I decided to use the chart object in a subreport. I wrote my own code to create the histogram data. It is working better, faster and more accurately than the Excel calls were before.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900