From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem view sheet activation using scripting

Hey all,

I am trying to activate any view sheet passed to MYSHEET.ACTIVATE()

I HAVE TRIED PASSING MYSHEET.ACTIVATE() EVERYTHING FROM CHNNAMES TO CHNNUMBERS, _
TO SHEET INDEX NUMBERS, SHEET NAMES, ALL IN AN ATTEMPT TO ACTIVATE THE DESIRED SHEET.

I have created a script for loading the contents in the dataportal, creating one sheet for a given chn name, then search all groups for the same chn name and loading each additional chn found into the correct sheet.

Here is  some of the script.

For Each MYSheet in View.Sheets
     IF CHNNAME(intMyResult) = VIEW.ACTIVESHEET.NAME THEN 'IF THE CORESPONDING(CORRECT) SHEET IS FOUND
            EXIT FOR ' FOR Each MYSheet in View.Sheets
          ELSE
            Call MySheet.Activate()      'INCREMENT THE SHEETS UNTIL THE CORRECT ONE IS FOUND
         END IF
 NEXT

When the correct sheet is not found and mysheet.activate() fires, it begins searching at the first sheet.  Thats not a probelm unless you have  80 or 90 sheets to increment like i have.    It is like driving from point A to point Y then back to point A to get to point Z.
It works but takes a lot of time.

I was wondering how to  activate the sheet that has the same name as the chn.

Thanks for any help
Paul




0 Kudos
Message 1 of 3
(3,416 Views)
Hi Paul
 
I am not sure if I understand your problem.
You can active a sheet in VIEW using the index or the name without using a loop over all sheets.
 
So use:
View.Sheets("Sheet 2").activate 'Activate sheet with the name "Sheet 2"
View.Sheets(3).activate 'Activate Sheet with index 3
 
or in your case
View.Sheets(CHNNAME(intMyResult)).activate
Hope this helps
Winfried
0 Kudos
Message 2 of 3
(3,409 Views)
Winfried
Thanks for the quick response.

View.Sheets(CHNNAME(intMyResult)).activate

Is working. 

I appreciate the help.

Thanks
Paul


0 Kudos
Message 3 of 3
(3,403 Views)