Loading spreadsheets into MS Office Spreadsheet 10.0 control

C

Carl Rapson

I'm working with the Office Spreadsheet 10.0 control, and I am wondering if
it is possible to load multiple (single-sheet) workbooks into a single
workbook in the control. In other words, I have a series of files (XML) that
were individually saved from the spreadsheet control (using the Export
method), and I would like to load each file as a new sheet within a single
workbook. I know how to load an entire workbook (with the XMLURL property),
but I can't see if there is a way to load a single worksheet. Is this
possible?

Thanks for any assistance,

Carl Rapson
 
A

Alvin Bruney

Here's one solution
Add a worksheet and make it the active worksheet, then load into this active
worksheet.
Call this routine for multiple worksheets. As long as you don't have a post,
the data will
remain in the worksheets.
Consider:

Spreadsheet1.ActiveSheet.Next.Select
Spreadsheet1.Worksheets.Add Spreadsheet1.Worksheets(1), ,2
Spreadsheet1.ActiveSheet.Name = "New Data Sheet"
Spreadsheet1.ActiveSheet.Range("A1:Z100").LoadText "sometext.txt", Chr$(9)

This may not be the simplest way to do it, but it should get you what you
want. Feel free to customize it as well.
 
C

Carl Rapson

Thanks, I will try it out.

Carl

Alvin Bruney said:
Here's one solution
Add a worksheet and make it the active worksheet, then load into this active
worksheet.
Call this routine for multiple worksheets. As long as you don't have a post,
the data will
remain in the worksheets.
Consider:

Spreadsheet1.ActiveSheet.Next.Select
Spreadsheet1.Worksheets.Add Spreadsheet1.Worksheets(1), ,2
Spreadsheet1.ActiveSheet.Name = "New Data Sheet"
Spreadsheet1.ActiveSheet.Range("A1:Z100").LoadText "sometext.txt", Chr$(9)

This may not be the simplest way to do it, but it should get you what you
want. Feel free to customize it as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top