04-12-2017 01:44 AM
Hello,
I have the script attached on the picture, actually, i wrote it to decrease automatically the size of the characters which is defined in the masterlayout. the problem is that diadem displays this error : No object with the specified name exists , this is in the line : set octrl = Report.sheets..(text2) ,
Any help please ?
Solved! Go to Solution.
04-12-2017 02:28 AM
Hi,
have you declared it at the beginning of the script using Dim?
04-12-2017 02:34 AM
thank you for your answer , Yes , it's the first line in the picture ,
04-12-2017 02:47 AM - edited 04-12-2017 02:50 AM
In which column is the error?
Also, are you sure you have Text2 in the Report?
04-12-2017 06:07 AM
Hi,
The error is in the 6th row , the 'text2' is actually defined in the master layout
04-12-2017 06:31 AM
Maybe it should be like that?:
Set oCtrl = Report.Sheets("Landscape Master").Objects.Item("Text2").ObjectType
04-12-2017 07:06 AM - edited 04-12-2017 07:11 AM
If you connect your master layout to a normal tdr layout which is loaded at the same time you execute your script, it will not work.
For your script the "Landscape Master" sheet only exists if your master layout tdrm file is actually opened in report module (connecting it in your tdr file is not enough here).
I think by design there is no way to access the text object of the master layout if your normal tdr layout is opened.
A master layout is meant to be the same for every tdr layout that's connected to it.
Why create a master layout in the first place if it's looking different in every other tdr layout later?
04-12-2017 03:35 PM - edited 04-12-2017 03:35 PM
Hi Say,
The only option I can find is to first load the master layout file, make your edits, then resave the master layout file, THEN load the dependent TDR file (make sure it's set up to load the master layout info each time). You can perform all these steps programmatically like this:
LayoutPath = CurrentScriptPath & "Example.TDR" MasterPath = CurrentScriptPath & "Example.TDRM" Call Report.LoadMasterLayout(MasterPath) Set oCtrl = Report.Sheets("Landscape Master").Objects("Text4") oCtrl.Font.Size = oCtrl.Font.Size - 2 Call Report.Refresh Call Report.SaveMasterLayout(MasterPath) Call Report.LoadLayout(LayoutPath) Call Report.Refresh
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-13-2017 04:38 AM
Hello,
Thank you for your answer , i tried this method but it displays the error showed in the logfile in the picture attached, any idea please?
04-13-2017 07:14 AM
Hello Brad,
Well , i think it 's fine for running, but i still have one problem, the masterlayout configured(where the fond size is modified) is not displayed with the layout when i run the script, i still have no change . the configuration is actually made in the initial Masterlayout .
Any ideas please ? 😞
Attached the final script that i made