Getting Excel Range Data and Saving as a String

L

LT

Hello,

I have a spreadsheet embedded on a form (works great) but I am trying to
find out if it is possible to save the contents of a range inside the Excel
container to a string so I can save it to a memo field in my database.

When I use the code below it just seems to be a single blank string...

Code:
Dim entireReceiptText As String

xlsReceiptContainer.ActiveWorkbook.Worksheets("Receipt").Range("A1:A34").Select

xlsReceiptContainer.ActiveWorkbook.Worksheets("Receipt").Range("A1:A34").Copy

entireReceiptText =
xlsReceiptContainer.ActiveWorkbook.Worksheets("Receipt").Range("A1:A34")

It is definitely copying the range as I can paste it into notepad if I break
into the code after the copy but it just doesn't seem to put it into the
string object.

Any ideas are greatly appreciated.

Thanks.

Lance
 
L

LT

I decided to take the easy route and just iterate through the range one cell
at a time and build up the string. Ugly but it works.

If anyone has a better method though I'd like to hear it.

Thanks for reading.
 

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