The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Refer to a workbook by folder+long name ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Iveta_

United Kingdom
6 Posts

Posted - 09/26/2021 :  07:40:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

yuki_wu

848 Posts

Posted - 09/27/2021 :  01:20:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000