View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Unger Dave Unger is offline
external usenet poster
 
Posts: 153
Default LoadPicture() error XL2007

Hi Peter,

Thanks for your reply, I'll have a look at your suggestion.

regards,

DaveU

On Apr 27, 3:55*am, "Peter T" <peter_t@discussions wrote:
Nasty!
Try and identify where the problem starts from with something like this

Sub test()
Dim sPic As String
Dim ole As OLEObject
Dim stdPic As StdPicture

* * sPic = "C:\<path\myPic.jpg"

* * Set ole = ActiveSheet.OLEObjects("Image1")
* * Logit "ole.Name " & ole.Name, True
* * 'Set stdPic = New stdole.StdPicture

* * Set stdPic = LoadPicture(sPic)
* * Logit "stdPic.Handle " & stdPic.Handle
* * Set ole.Object.Picture = stdPic
* * 'or simply
* * 'ole.Object.Picture = stdPic
* * Logit "ole.Object.Picture.handle " & ole.Object.Picture.Handle

End Sub

Function Logit(s As String, Optional bNew As Boolean)
Dim sLog As String
Dim ff As Integer

* * sLog = Application.DefaultFilePath & "\Logit.txt"
* * If bNew Then
* * * * On Error Resume Next
* * * * Kill sLog
* * * * On Error GoTo 0
* * End If

* * ff = FreeFile
* * Open sLog For Append As #ff
* * Print #ff, s
* * Close #ff

End Function

Regards,
Peter T