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
 Origin Forum
 copy data into different sheets in a workwork
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Marcel Spillker

Germany
Posts

Posted - 03/03/2008 :  01:24:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): Origin 8 SRO v8.0725 (B725)
Operating System: Win XP
Hello,

i´d like to copy some data from an excel workbook to origin via VBA.
I know that I can use "Putworksheet..." This is running very well.
But my workbook in Origin 8 consists of different worksheets, like Sheet1, Sheet2, ...
At the moment I don´t know how to copy data into Sheet2, even Sheet1 is activate.
Has someone an idea how to do this?

Deanna

China
Posts

Posted - 03/03/2008 :  9:01:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, putworksheet pastes the data into the active worksheet of the specified workbook.

Generally, it requires making Sheet2 active before you paste the data into it.

There is an example in "<Origin Program folder>\Samples\Automation Server\VB\SendNumericDataToWks". Please refer to it.

Deanna
OriginLab Technical Services
Go to Top of Page

Marcel Spillker

Germany
Posts

Posted - 03/05/2008 :  03:04:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Deanna,

thanks for your reply. It helps alot.
But I didn´t find a way to activate sheet2 in the example.
In the example I find a way to check if workbook "Data" is
existing. But no way to check for sheet2, sheet3, ...

I hope you can help me ones more.

Marcel
Go to Top of Page

Echo_Chu

China
Posts

Posted - 03/05/2008 :  05:43:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Could you try execute "page.active", for example

Public oApp As Origin.Application
'//To active the second sheet
ThisWorkbook.oApp.Execute ("page.active=2")





Edited by - Echo_Chu on 03/05/2008 05:43:52 AM
Go to Top of Page

Marcel Spillker

Germany
Posts

Posted - 03/05/2008 :  11:25:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Echo_Chu,

thanks for your answer. It works very fine. Thank You.
But there is still another question:
My Origin file consits of different workbooks, graphs,...
How can I activate the workbook in which I´d like to paste my
data?
E.g. workbook "Data1" is active and I´d like to paste my data in
workbook "Data2" ?

Marcel
Go to Top of Page

larry_lan

China
Posts

Posted - 03/06/2008 :  03:12:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

How about

ThisWorkbook.oApp.Execute ("win -a Data2;")


to active the worksheet window "Data2"? I think you can run LabTalk commands in this way.

Thanks
Larry
OriginLab Technical Services
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