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 for Programming
 LabTalk Forum
 Using range variable to access wks methods

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
duffy01 Posted - 08/20/2014 : 05:06:59 AM
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
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 08/20/2014 : 09:12:27 AM
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.

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