LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pasting values only Excel

Solved!
Go to solution
Yes you are correct. Passing the referance should help me get closer to my goal. I will update this thread asap and try your suggestions.
0 Kudos
Message 11 of 19
(1,544 Views)
I'm trying to pass the ref from one vi to the next. However, I am having a problem should I be passing every referance? or just the excel application?
0 Kudos
Message 12 of 19
(1,534 Views)
It depends on what your VIs are doing. If you look at the example that ships with LabVIEW called "Write Table to XL" then you see that the different VIs use different references. So, the answer is: how did you write your subVIs?
0 Kudos
Message 13 of 19
(1,524 Views)
So If my sub vi are in the order of  Copy, Select WorkSheet, Select Cell, and Paste. Would I need to make sure that the last thing it passes is the referance values for worksheet since each sub vi is using the same worksheet referance?
0 Kudos
Message 14 of 19
(1,522 Views)

I broke the code down a bit more to make it eaiser. I have excel opening once and I am sending that referance to the other sub vis. I am recieving this error when I attempt to paste values from one workbook to another workbook.

 

Error -2146827284 occurred at Exception occured in Microsoft Office Excel: PasteSpecial method of Range class failedHelp Path is D:\Program Files\Microsoft Office\Office12\1033\XLMAIN11.CHM and context 0 in Select Select Cell & Paste.vi-

 

 

I have also attached a vi which has what I am currently working with.

 

Its rather simple you choose your range that you wish to copy in table copy, select the sheet and file you wish to paste into (can be the same workbook) and it will paste close everything for you.

Message Edited by MrSafe on 07-22-2009 01:52 PM
0 Kudos
Message 15 of 19
(1,510 Views)
I have attached the subvis. Which are update files from before.
0 Kudos
Message 16 of 19
(1,507 Views)
Your VIs and how you're using them makes no sense. You're opening a reference to Excel in "Table Copy", passing out that reference, only to open a new one in "Select Worksheet". You didn't include "Quit App", but I wouldn't be surprised if you're opening a new one in there as well. Also, in the "Sample" VI you're calling the subVIs, and passing in empty paths, so they have no workbook to open. Are you keeping the subVIs open when you're doing this, and trying to set the values of the controls on the subVIs yourself by hand? The values of controls should be set by the parent VI.
Message 17 of 19
(1,498 Views)

You're opening a reference to Excel in "Table Copy", passing out that reference, only to open a new one in "Select Worksheet".

I assumed you must open a new referance for every file that you open. But clearly from what your saying it is only needed once.
 

You didn't include "Quit App", but I wouldn't be surprised if you're opening a new one in there as well.

😃 luckly it is not.
 

Also, in the "Sample" VI you're calling the subVIs, and passing in empty paths, so they have no workbook to open.

I left the paths empty incase you were to run it which would allow you to select your own files. This is clearly a mistake on my part. 
 

Are you keeping the subVIs open when you're doing this, and trying to set the values of the controls on the subVIs yourself by hand? The values of controls should be set by the parent VI.

No it is filled in automatically. All the values are copied and put in correctly the portion I have an issue with is the actual copying of the information within an excel file.
 
 
From what I gather when using excel and labview, once you open a referance you may use that same referance as many times as possible without the need for opening a new one. The only time you must open a new referance is if you were to close it. Correct?
If this is the case I have much work to do on what I have been doing. Now that I have an understanding of the problem I can see why it makes no sense. 

 

 

 

 

Message Edited by MrSafe on 07-22-2009 03:25 PM
0 Kudos
Message 18 of 19
(1,494 Views)
Correction I ment pasting*
0 Kudos
Message 19 of 19
(1,489 Views)