View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Can I save a copy of Excel workbook in MSSQL database using VBA?

Karla,
You cannot convert a WB to an image, but you can Copy/Paste Special a range
as a picture.
However, on my systems, you are limited to relatively small ranges.
You would still have to get the picture out of Excel and into a suitable
graphics format, either in memory or on disk, before you can send the bytes
to the DB.

If you could do it in C++, something similar in VB/VBA will (probably)
exist. Depends how you did it ?

It would be easier to install a <printer that can convert to a graphic.
Possibly:
http://www.print-driver.com/howto/co...le_to_jpeg.htm

NickHK

"Karla" wrote in message
...
Our User group would like a button in an Excel workbook that saves a copy

of
the workbook in MSSQL database. We have done something similiar in a Web

app
using C#. The excel workbook is stored in MSSQL db as an image. That app

has
access to the workbook as a saved file, not as an active workbook during

that
process. Converts the file to byte then image.

I can't duplicate the process successfully in VBA code. The workbook

object
doesn't seem to support the Savepicture or CopyAsPicture functions. In

order
to use the byte conversion I need the Length of the file(workbook),

another
property I am unable to use with the workbook object.

Any help would be appreciated. I am using VBA 6.3. Thanks.