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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Using range variable to access wks methods
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

duffy01

Germany
1 Posts

Posted - 08/20/2014 :  05:06:59 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. : 8.5.0G SR1
Operating System: Win 7

Hi,

sorry for the maybe dumb question but this problem drives me crazy since some time within different circumstances. I read Helpfiles a lot but don`t get it and I want to understand now.

Basic Idea is, to work between columns in different worksheets, maybe also in different Workbooks. Since I want to reuse the scripts for different purposes, I want to be able to just change Worksheetnames (Sometimes also Workbooknames and Columnnames) only in the headerin order to make the script work.

My way is to setup a two range variables for both sheets, e.g:

range aWks=!;
range eWks=[Book1]Ergebnis!;

typically I want to reference on a certain column using xfuncionts etc. In many cases I am able to do that via substitution notation, but I almost always have to try several times to find out which is the correct way, and sometimes I am not able. Let`s give an example:

I want to start by inserting a noew column in eWks:
eWks.insert (new); // works

But since I want to assure, that it is inserted as second column I would like to take care about it via Labtalk before. So I insert something like this before:
eWks.col=2; // Doesn't work, because Origin seems always to use the activated Worksheet as reference.

Same accounts, when I try to change values of user parameters. But it works fine using the above mentioned notation, when I try to change type of col eg:
eWks.col2.type=4; // Works

Could somebody explain me what I do not understand in the progamming concept or give me a short code example, which explains this, without changing the active Workbook?

Thanks in a advance
Martin

greg

USA
1378 Posts

Posted - 08/20/2014 :  09:12:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This should always work:

range eWks = [Book1]Ergebnis!;
eWks.col = 2;
eWks.insert(new);
eWks.col2.type = 4;

regardless of what sheet it active or where [Book1]Ergebnis is in your project.

This code
range aWks=!;
will only create a sheet range out of the active worksheet.

So I am not sure what problem you are having.
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