PC Review


Reply
Thread Tools Rate Thread

Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet

 
 
Ant Waters
Guest
Posts: n/a
 
      3rd Sep 2003
I am writing a VB DLL / xla that needs to be able to programmatically attach
a JET database to a worksheet, and then re-open it later on. This needs to
happen without user intervention. So far I have considered the following:

1) Using the Insert Object approach to store the database in an OLE
object...BUT:
(a) How do you do it programmatically?
(b) It seems to be application specific, so would only work if the user
had Access.
Is there a generic object packager that I have missed, and that can be
called through VB code, and that is guaranteed to be on all machines?

2) Reading the JET database into a byte array, converting to a string, and
saving in the workbook...
The read and convert seemed to work OK but all attempts to save to a
workbook failed, even if I just try to save the first 100 characters. I
guess that the string contains nasty characters that excel won't allow to be
saved to a cell? Is there anwhere else I can save it in a workbook?

A related question is whether it is possible to re-open the JET database
without first saving to a file i.e. open it in-memory only. I know this
isn't an Excel question but someone might know the answer.

Thanks in advance,

Ant Waters



 
Reply With Quote
 
 
 
 
Keith Willshaw
Guest
Posts: n/a
 
      3rd Sep 2003

"Ant Waters" <(E-Mail Removed)> wrote in message
news:3f55b1b8$0$46004$(E-Mail Removed)...
> I am writing a VB DLL / xla that needs to be able to programmatically

attach
> a JET database to a worksheet, and then re-open it later on. This needs to
> happen without user intervention. So far I have considered the following:
>
> 1) Using the Insert Object approach to store the database in an OLE
> object...BUT:
> (a) How do you do it programmatically?


I dont believe there is OLEsupport for this method

> (b) It seems to be application specific, so would only work if the

user
> had Access.
> Is there a generic object packager that I have missed, and that can be
> called through VB code, and that is guaranteed to be on all machines?
>


If you use a VB6 or .Net dll you can have all the database
query code in that using ADO and your client wont need
MS Access. The access db file would have to be save separately though

> 2) Reading the JET database into a byte array, converting to a string, and
> saving in the workbook...
> The read and convert seemed to work OK but all attempts to save to a
> workbook failed, even if I just try to save the first 100 characters. I
> guess that the string contains nasty characters that excel won't allow to

be
> saved to a cell? Is there anwhere else I can save it in a workbook?
>


This isnt a good option IMHO, the only way you could make it work would be
to
convert the binary data into Ascii format such as Mime or Base 64
but this is very inefficient

> A related question is whether it is possible to re-open the JET database
> without first saving to a file i.e. open it in-memory only. I know this
> isn't an Excel question but someone might know the answer.
>


Yes, you can use ADO (or DAO) to open the database
and read the values into a recordset which can be manipulated
from either VB or VBA

Keith


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching an Excel Worksheet as An Object... Bob Barnes Microsoft Excel Programming 0 24th Apr 2008 09:33 PM
Attaching a xml schema to a excel worksheet =?Utf-8?B?SWFuIE1hYw==?= Microsoft Excel Programming 0 4th Jul 2007 07:32 PM
Insert multiple row of data in database from excel worksheet shantanu Microsoft C# .NET 0 22nd Mar 2007 09:50 AM
how do i save a large amount of data in a worksheet excel 4 =?Utf-8?B?UmFuYQ==?= Microsoft Excel Worksheet Functions 2 13th Jun 2006 11:01 AM
Exporting data from Access database to Excel worksheet Gwyn Hodges Microsoft Excel Crashes 0 3rd Jul 2003 08:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:56 PM.