キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Adding a sheet in excel with a specific name.

How can I add a sheet in excel with a specific name after an existing sheet with an unknown name.
0 件の賞賛
メッセージ1/11
10,574件の閲覧回数
Just use the Sheets->Add function and wire the existing sheet index into the After input.

From the Workbook refnum:
Wire Property Node - Workbook->Sheets
Wire Method Node - Sheets->Add, wire the After input
Convert the Variant from Add into a WorkSheet type
Wire Property Node - WorkSheet Name
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
メッセージ2/11
10,574件の閲覧回数
Thanks for the help. That worked great. Now I need to copy the content of the first sheet and paste it in the newly created sheet. Any ideas?

Jonathan
0 件の賞賛
メッセージ3/11
10,574件の閲覧回数
It is easier to duplicate an existing sheet than to add a blank sheet and copy the entire contents.

To duplicate sheet:
Use the Sheets->Item(x) to select the sheet
Convert the output to a WorkSheet
Use method WorkSheet->Copy, wire the index into After
Use Sheets->Item(y) again to select the new sheet

To copy contents to the new sheet:
Wire target's WorkSheet->Range("A1") to specify destination
Use Sheets->Item(x) to select the source sheet
Convert source to WorkSheet
Wire source to property WorkSheet->UsedRange
Wire to method Range->Copy, wire target range to Desination input
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 件の賞賛
メッセージ4/11
10,575件の閲覧回数

Hello Michael,

I want to duplicate the sheet in my workbook. I built a VI as directed by you, but it is not duplicating the sheet. I am using Labview 8.2. I have attached my VI, in which "source" is the sheet to be duplicated and "target" is where the sheet is to be copied. I am liitle bit unsure about the flow/logic of block digram. Where is my mistake ?

Thanking you

Pranav

0 件の賞賛
メッセージ5/11
10,150件の閲覧回数
I believe this thread will help you find a solution:

http://forums.ni.com/ni/board/message?board.id=170&message.id=53394&requireLogin=False

Cheers!
0 件の賞賛
メッセージ6/11
10,135件の閲覧回数

Thanks for reply. However, I have modified my Duplicate sheet.VI as shown in new attachment. Please give feedback, whether it is ok or not.

Regards

0 件の賞賛
メッセージ7/11
10,124件の閲覧回数
Your VI looks good, pranav. Does it accomplish everything you'd like, or is there more functionality that we can help you with?
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments
0 件の賞賛
メッセージ8/11
10,114件の閲覧回数
Hello, Thanks for your feedback.  I wanted to create a duplicate sheet of a specified sheet in the same workbook with diffrent name keeping original intact. I have tested it and found ok.
 
In th main VI, the block diagram functions used after this sub VI, prompt user to make necessary changes in newly generated sheet as required by the application and then save it again. For example, original sheet is "Acquisiton", which is duplicated with the name "Correction" keeping Acquisition intact. After this, Main VI will remain in wait state untill user makes necessary changes in "correction" sheet and press "save & exit" button.
 
Pranav
0 件の賞賛
メッセージ9/11
10,104件の閲覧回数

I'm getting the error -2146827284 with no description when using the Sheets.Add with an U16 number wired to the After field. When I try using the Sheets.Add without the field wired I get no error. Is there any proper way I'm supposed to be converting the variant?

0 件の賞賛
メッセージ10/11
9,506件の閲覧回数