Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Marcel Spillker
Posted - 03/03/2008 : 01:24:51 AM 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?
5 L A T E S T R E P L I E S (Newest First)
larry_lan
Posted - 03/06/2008 : 03:12:43 AM 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
Marcel Spillker
Posted - 03/05/2008 : 11:25:19 AM 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
Echo_Chu
Posted - 03/05/2008 : 05:43:26 AM 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
Marcel Spillker
Posted - 03/05/2008 : 03:04:35 AM 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
Deanna
Posted - 03/03/2008 : 9:01:21 PM 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.