The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 The list of sheets name

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dominik.mierzwa Posted - 02/08/2020 : 12:41:31 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2020 (64-bit)
9.7.0.185 (Academic)
Operating System: Windows 10 Pro

Hi,

I Book1 with 3 sheets (name: A, B, C) and Book2 with one sheet (name: report). In column A of the report sheet, I would like to get the names of the sheets from Book1. The script should dynamically change the list after add/remove sheets from Book1.
How to do this? I have tried with page.nlayers and for loop but have no idea how to get the name of particular sheets.

Can you help?



Kind regards,
Dominik
4   L A T E S T    R E P L I E S    (Newest First)
dominik.mierzwa Posted - 02/08/2020 : 2:33:42 PM
It works perfectly! How about the "". I use this list of sheets as a reference (similar as indirect function in Excel) in the formula:

=[Book1]%(col(A)[i]$)!J1

And if the name is not in "" the formula does not work.

Kind regards,
Dominik

Edit:

SOLVED:

range bk=[book1];
int kk = bk.nlayers;
range sh = [book1]$(kk)!;
range aa = [book2]sheet1!col(1);
string strchar$=char(34)$;
aa[kk]$=strchar$ + sh.name$ + strchar$;
cpyang Posted - 02/08/2020 : 2:22:04 PM

range bk=[book1];
int kk = bk.nlayers;
range sh = [book1]$(kk)!;
range aa = [book2]sheet1!col(1);
aa[kk]$=sh.name$;


CP
dominik.mierzwa Posted - 02/08/2020 : 2:11:52 PM
Ok, I got something like this:
int k =Book1!page.nlayers;
Range Sh=[Book1]$(k)!;
sName$ = Sh.name$;
[Book2]Sheet1!Col(1)[$(k)]=sName$;


But the last line does not work. Moreover, how to put the sName$ in the ""? I'd like to have something like this:
"Sheet1".

Kind regards,
Dominik
cpyang Posted - 02/08/2020 : 1:18:53 PM
You can use Range notation to get to a sheet as the wks object, see

https://www.originlab.com/doc/LabTalk/guide/Range-Notation

For example, to get the sheet name of book1 second sheet,

range ww = [book1]2!;
ww.name$=;


See

https://www.originlab.com/doc/LabTalk/ref/Wks-obj


CP

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000