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
 Forum for Origin C
 Excel Output

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
Nemuri Posted - 07/14/2004 : 5:06:30 PM
I'm automating parts of a process in Origin for my company (we've already bought a license for the standard edition of Origin). So far the documentation provided has been very helpful, but at the end of the automated data processing I'd like to be able to output into a given cell range within a pre-existing Excel spreadsheet. I've seen many examples of reading from an Excel spreadsheet, and even outputting to a Word document, but nothing regarding piping generated output into an existing spreadsheet without destroying currently existing data. Is there any way to do this?
3   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 08/09/2004 : 1:53:51 PM
Hi Nemuri,

Good to hear that you resolved your problem. My apologies for not understanding the problem well and offering a solution right here on the forum.

I just wanted to point out that the main purpose of the forum is for users to exchange/share ideas and information on using our products, although we try to answer as many technical questions on the forum ourselves as possible.

As a customer who purchased our product, you have access to our support in multiple ways other than just posting on the forum, such as sending e-mail, calling OriginLab toll free (US/Canada), live chat during business hours etc. Please visit our main support site for more information:
http://www.originlab.com/index.aspx?s=9
and please do contact us next time via these other options.

Easwar
OriginLab

Nemuri Posted - 08/09/2004 : 12:15:34 PM
After much searching, I have found the answer to my own problem.

// Declare Excel objects
Object oExcel, oExcelWkbks, oExcelWkbk, oExcelWksh;

// Create an Excel application object and set it as invisible
oExcel = CreateObject( "excel.application" );
oExcel.Visible = false;

// Get the workbooks collection of the Excel object
oExcelWkbks = oExcel.Workbooks;

// Open the workbook with data to be analyzed
oExcelWkbk = oExcelWkbks.Open( "C:\\<path to file>\\<filename>.xls");

// Selecting the 1st worksheet in the workbook
oExcelWksh = oExcelWkbk.Worksheets(1);

// Casting to string, and storing in Excel
oExcelWksh.Cells(4,16) = (string)sMatStatsSum.dMin;

Apparently I needed to cast my data to string in order to move it to Excel. Integers wouldn't generate an error, but they wouldn't show up in the worksheet after I saved it either. This is a very simple solution that took me days to find. I would like to insist this be added to the COM documentation, as it would save people in my situation a rather large amount of time. I would also like to add that after purchasing OriginPro, I had expected much better support WRT asking such a simple question.
easwar Posted - 07/14/2004 : 5:28:13 PM
quote:

... but nothing regarding piping generated output into an existing spreadsheet without destroying currently existing data.



Hi,

I presume you are using OriginPro as a client and are launching Excel as a sever from Origin C code and then want to send data to Excel? If this is a case, you should be able to send data into a specific named range of Excel cells. Will need to look up the appropriate Excel VBA syntax to do that and then program that in Origin C. As for piping the data without destroying existing data, what do you mean by that? If you write data to a named range, that will replace existing data, unless that range is locked from editing in Excel...can you provide more details?

Easwar
OriginLab



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