Excel 97, SR1
I'm upgrading a workbook from Excel 95 to 97, Can anyone tell me why
this doesn't work....?
dim s as shape '--- or object it doesn't help either way
set s = ActiveSheet.ChartObjects(1).Chart.Shapes.AddPicture _
("d:\projects\excel\progresslog\bitmaps\sst.bmp",
_
msoTrue, msoFalse, 10, 10, 24, 12)
I get runtime error 1004, 'application defined or object defined
error'. The failure is in the AddPicture method; I can view the shapes
collection in the watch window.
The bitmap file exists and the path is correct. I can insert it manually
in Excel using 'Insert\Picture\From file...' menu option but it refuses
to work from VBA. Any suggestions greatly appreciated, I've already
spent hours on this!!!
(I also tried InsertOLEObject with similar results. There is no
protection applied to the workbook.)
Thanks
Andy.
(Remove xxx from email address to reply)
This worked for me:
Sub test12()
Dim s As Shape
Set s = ActiveSheet.ChartObjects(1).Chart.Shapes.AddPicture _
("C:\windows\tiles.bmp", msoTrue, msoFalse, 10, 10, 24, 12)
End Sub
So your syntax is correct for a chart embedded on a worksheet. If you
are running this from a button, try just running it from a common module
with the run command.
HTH,
Tom Ogilvy
Thanks for taking the time to look into this.
Andy
Regards,
Thanks.
Regards,
Tom Ogilvy
Andy Clark wrote in message <36E0F198...@saga.com>...
by manually copying DLL files from the OS folder on the CD to the winnt\
system32 folder.
Some of the files I replaced were newer than the Office versions so I suspect
the that's why the install program didn't replace them. Pity it didn't give a
warning, might have made troubleshooting easier. Now it's a case of waiting
to see what's broken! ('Fraid I don't know exactly which one solved it,
I don't have that much patience!)
One possibility that occurred to me was that I had the Word97 and Excel97
viewers installed before the upgrade to Office 97. These appear to be cut
down versions of the real thing and may have installed crippled, post-dated,
DLLs on my system???
Thanks for the suggestions Tom.
Rgds Andy.