The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Refer to a workbook by folder+long 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
Iveta_ Posted - 09/26/2021 : 07:40:42 AM
Hello, in each folder that I run my code I would like to be able to refer to a workbook via the "long name", as opposed the unique "short name" (the long name is the same in each folder of the project and it will make my life a lot easier and the code more useful).

All the commands (activate window, get column range, etc, etc) are based on the short name because it is unique for the entire project, I get that.
But is there any way you can use the long name + folder name instead, such as:

[folder2/longname]Sheet1!Col(A)

Otherwise for each folder (hundredths of them) I have to manually find the short name (which are e.g. shortname1, shortname2, shortname3 etc but not in order) to pass it as a variable, so it can recognise the workbooks I need, and this will be very time consuming..

Apologies if I have missed this in the documentation.
1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 09/27/2021 : 01:20:45 AM
Hi,

I am sorry that we don’t support folder in range notation so far, but I provide a function to get the short name via the long name and folder name.


function string GetShortName(string strFolder, string strLongName){
	pe_cd /%(strFolder$);
	string strShortName$;
	doc -ef W{
		if(strLongName$ == page.longname$)
			strShortName$ = %H;
	}
	return strShortName$;
}


With this function, for example, you can get the short name like:

string strName$ = GetShortName("Folder1", "MyBook")$;
strName$=;


Regards, Yuki


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