I'm been holding off upgrading from DIAdem 2015 to the latest version because I knew that I had a massive number of scripts that were going to have to be updated to deal with the now obsolete commands and the mandatory use of the object oriented script interface. However, I was finally motivated to make the switch because of a new added feature that I'd wanted for a long time.
So far, the changes have been pretty easy, but accessing the values in existing objects has been elusive.
As an example - in my old scripts I used the now obsolete GraphObjOpen/Close commands and TxtTxt variable like this:
TxtTxt = "Test Title"
I closest I have been able to get after looking through the help files is something like this:
Set oTxtTxt = Report.ActiveSheet.Objects.Add(eReportObjectText, "Title")
oTxtTxt = "Test Title"
Unfortunately, this wants to add a new report object named "Title" , which already exists, so it fails.
I've been unable to find a way to simply set the Text value in the existing object.
Solved! Go to Solution.
It is only a small change necessary. You don’t need to ADD the object you can direct address it.
Dim oText Set oText = Report.Sheets("Blatt 1").Objects("Text1") oText.Text = "This is a test."
If you create such an object in REPORT and you open it, you can use the keys CTRL+SHIFT+C in the open dialog to copy the whole script syntax into the clipboard. After pasting this into the script editor you have all commands to manipulate all parameters of the object (and in comments how to create it).
Please keep in mind, depending of the object type you get a long list of commands, but you can reduce it to those which are necessary.
Alternatively, you can use the intelligence with REPORT + dot to find the commands.
Thanks for you help Walter,
I had already tried removing the .add object, but I got still an error. It turned out that I had to use
Report.Sheets().Objects as in your example
It seems like almost all of the examples in the help files for manipulating report objects use Report.ActiveSheet.Objects instead of Report.Sheets().Objects(). They also assume that you are adding them rather than updating their values.
By using Report.Sheets().Objects() as a foundation, I was able to struggle through converting some of my other scripts which update values in existing Tables and Polar Plots.
I was not aware of the CTRL+SHIFT+C trick. That is awesome!
I'm not understanding your last sentence in your reply about using the intelligence with REPORT + dot to find the commands. Can you explain that a bit more?
The script code also works with “ActiveSheet” if the sheet was already the active sheet or was activated before using this object.
Dim oText call Report.Sheets("Blatt 1").Activate Set oText = Report.ActiveSheet.Objects("Text1") oText.Text = "This is a test."
Intelligence is of course a misspelling, it should be intellisense and it means the autocompletion. If you type in the word REPORT and then the “.” you get a list of possible commands or methods. This is similar to CTRL+SPACE. If you type in “REP” and the CTRL+SPACE, you get a list possible commands or methods which start with this characters.
By the way, if you open the DIAdem help and look in the index for “shortcuts” you find a sorted list of all DIAdem shortcuts.