Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rename a chart object using VBa

Hi .

I have this code to create a table:

set Graph = ActiveDocument.Sheets("Main").CreateStraightTable
id = Graph.GetObjectId
msgbox "Chart Name = " & id

, so I know the chart ID ( say "Document\CH07) , but I want to rename it to CH01. I suspect this my be through the getproperties, but assistance please!

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

The macro is similar to this:

sub changeID

rem ** Change unique ID of a chart **

set g = ActiveDocument.GetSheetObject("CH01")

set gp = g.GetProperties

GP.GRAPHLAYOUT.Frame.ObjectId = "MyChart"

g.SetProperties gp

end sub

You can also check my attachment.

(After you click, the ID will change, the second time it will fail, ok?)

Regards,

Erich

View solution in original post

3 Replies
erichshiino
Partner - Master
Partner - Master

The macro is similar to this:

sub changeID

rem ** Change unique ID of a chart **

set g = ActiveDocument.GetSheetObject("CH01")

set gp = g.GetProperties

GP.GRAPHLAYOUT.Frame.ObjectId = "MyChart"

g.SetProperties gp

end sub

You can also check my attachment.

(After you click, the ID will change, the second time it will fail, ok?)

Regards,

Erich

Not applicable
Author

Many thanks Eric, this is exactly what I needed!

Is there a reference document (or the api) avauilable where I can find details of the object properties? 

erichshiino
Partner - Master
Partner - Master

Yes, you can use the API Guide.qvw

It's located at:

C:\Program Files\QlikView\Documentation

You can also read the QV Automation reference.pdf.

There is a lot of examples in the .qvw

I think it`s not so clear how to follow it... for example, when i used:

.GRAPHLAYOUT

You get get more details by understanding the object iGraphLayout and so on...

Hope this helps,

Erich