Getting Excel Range Data and Saving as a String

  • Thread starter Thread starter LT
  • Start date Start date
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
 
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.
 
Back
Top