T
Tim Johnson
As we all know, the export to xls from a report loses all formating. I've
come up with a workaround for all of the information within a report except
for an embedded image. I can place the image into a spreadsheet using code
if it has a static path, but this is less than ideal. Here's the broken code
I've been trying to use:
Dim xlApp as Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim imgPic as Image
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
Set imgPic = Reports!rptMyReport.Controls!imgLogo
With xlBook.ActiveSheet.Range("a1")
Set myPict = .Parent.Pictures.Insert(imgPic)
End With
This returns Run-Time error 1004: Unable to get the insert property of the
Pictures class.
If I put in a static pathname instead of the imgPic object, all's well, but
for my purposes, this will not work. Excel's vba help file is less than
helpful.
Does anybody have any ideas they'd mind throwing at me?
Thanks in advance,
Tim
come up with a workaround for all of the information within a report except
for an embedded image. I can place the image into a spreadsheet using code
if it has a static path, but this is less than ideal. Here's the broken code
I've been trying to use:
Dim xlApp as Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim imgPic as Image
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
Set imgPic = Reports!rptMyReport.Controls!imgLogo
With xlBook.ActiveSheet.Range("a1")
Set myPict = .Parent.Pictures.Insert(imgPic)
End With
This returns Run-Time error 1004: Unable to get the insert property of the
Pictures class.
If I put in a static pathname instead of the imgPic object, all's well, but
for my purposes, this will not work. Excel's vba help file is less than
helpful.
Does anybody have any ideas they'd mind throwing at me?
Thanks in advance,
Tim