ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Problem with getHTMLImageMap
Posted by Alexx on Apr-29-2018 06:58
I use the following code to insert a Chart on a worksheet Excel:

Private Sub CommandButton_Click()
Dim Obj As OLEObject
Dim rng As Range
Dim x As Object

    Set rng = Me.Range("D10")
    Set Obj = Me.OLEObjects.Add(ClassType:="CDChartViewer.ChartViewer", Left:=rng.Left, Top:=rng.Top)
    Set x = Me.OLEObjects(Obj.Name).Object

Call MyChart(x)
End Sub

Everything works, the Chart is created, but getHTMLImageMap method does not work correctly.
getHTMLImageMap method works only if I add the ChartViewer to the excel sheet manually, or go into the design mode....
I recorded the video, what happens if I add Chart programmatically:

https://www.youtube.com/watch?v=MSWs-FcKlsI&feature=youtu.be

!!! note that the Chart before going into design mode looks rather turbid.

Is it possible to solve this problem?
Thank you.

  Re: Problem with getHTMLImageMap
Posted by Alexx on Apr-30-2018 03:45
In addition to my previous post.

I understood, that this was not a problem of the method getHTMLImageMap.
When Chart object is added programmatically, it is inactive, until I press the "Design Mode" button twice. Why is this happening?

I need to create an excel sheet and a graph dynamically, so the variants with the graph hiding are unsuitable.
How can I solve this problem?

  Re: Problem with getHTMLImageMap
Posted by Peter Kwan on May-01-2018 12:58
Hi Alexx,

I suspect the Excel is not forwarding the mouse events to the certain controls if they are added dynamically. From the Microsoft forum post below, it occurs for the standard ListBox "Forms.ListBox.1" too. I have tried myself, and it does occur to the ListBox. (The items in the ListBox are not selectable as if the ListBox does not received any mouse event, unless the Design Mode is toggle on and off.) See:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6cdccfa8-0e14-4ad9-b0f6-bbc8cd8091ac/vba-and-vbnet-code-to-turn-off-design-mode-in-excel-application?forum=exceldev

I tried the solution at the end of the above post, which is to programmatically turn the design mode on and off, and the method works in my case.

Regards
Peter Kwan

  Re: Problem with getHTMLImageMap
Posted by Alexx on May-02-2018 01:54
The solution is not the best, but it works.

Thank you.