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
 Copy/Paste

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
Tryphon Posted - 06/17/2015 : 4:38:42 PM
Version: Origin 8.0
Programming : Labtalk

Hello,

I want to copy an entire Worksheet into an Excel sheet including the Long Name, Units and Comments rows.

What is working now : with the mouse, I can select the entire worksheet clicking the empty grey cell at (0,0) position, copy it and paste it in an Excel sheet created by the "New Excel" button.

Therefore, an internal command exists in Origin that is able to copy ALL the worksheet in one shot

I want to do that automatically using Labtalk.

The following code works partially :


win -a MySheet;
worksheet -s 1 0 $(wks.ncols) 0;
menu -e 57634; //The copy command in the Edit menu
win -a MyExcelSheet;
excel.runrange(Sheet1,A4);
excel.run(PasteData);


where PasteData is an Excel macro recorded in MyExcelSheet:

Sub PasteData()
ActiveSheet.Paste
End Sub

Of course this code cannot select the Long Name, Units and Comments rows.

How to do this with Labtalk ?

Thank you.
6   L A T E S T    R E P L I E S    (Newest First)
Tryphon Posted - 06/19/2015 : 08:32:50 AM
I need to ask the administrator for this update.

Thank you.
SeanMao Posted - 06/19/2015 : 05:10:04 AM
Hi,

I guess that's it.

My Origin 8 version is OriginPro 8.0 SR6 version v8.0988.

You should update your Origin 8 to latest patch.

Regards!

Sean
Tryphon Posted - 06/19/2015 : 05:06:50 AM
Hello,

Maybe, what went wrong is related to the version? I use the version 8.0724 and I cannot see the "Copy (including labels rows)" command in the edit menu.

Secondly, when I use the command

worksheet -s 1 0 $(wks.ncols) 0;

it produces this selection :



but not the selection in your example.
SeanMao Posted - 06/18/2015 : 10:01:26 PM
Hi,

The answer to your concern is yes, Origin can copy entire worksheet including column label rows.

Menu id 38799 corresponds to menu item Copy (including label rows) as shown below:



What you have used previously is menu 57634 corresponding to Copy only.

To know the menu id of a menu item, you can hold Ctrl + Shift key and click on that item, the menu id will be output to Script Window.

I mean you should replace line menu -e 57634 with line menu -e 38799 in former post.

I run the following script as you have written:


win -a MySheet;
worksheet -s 1 0 $(wks.ncols) 0;
menu -e 38799; //The copy command in the Edit menu
win -a MyExcelSheet;
excel.runrange(Sheet1,A4);
excel.run(PasteData);


Below is the result I got:




It ran exactly as you wanted. I am not sure what went wrong on your side.

Regards!

Sean
Tryphon Posted - 06/18/2015 : 08:20:20 AM
Hello,

Thank you for the answer.

menu -e 38799 did not help or I do not understand how to use it.

I did a mistake in my initial post :

"Therefore, an internal command exists in Origin that is able to copy select ALL the worksheet in one shot"

before copying.

Another idea ?

Thank you.
SeanMao Posted - 06/17/2015 : 10:15:18 PM
Hi,

You only need to modify one line:


menu -e 38799; // Copy(including Label Rows) option


Regards!

Sean

OriginLab Tech. Service

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