Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LoadPicture Function or Sub not Defined Error 1

Status
Not open for further replies.

mo2783

Programmer
Nov 16, 2003
68
GB
Hi

i have the following code which will insert a graph on an image box on a form in Excel 2003.

Code:
Public Sub UserFormChart()
    fname = ThisWorkbook.Path & "\ Ch.gif"
    Set ch = Sheets("Data").ChartObjects(1).Chart
    ch.Export fname, "Gif"
    UserForm1.Image1.Picture = LoadPicture(fname)
    Kill fname
    UserForm1.Show
End Sub

I am getting the follwoing error "Sub or Function not defined" on the "LoadPicture(fname)" when compiling.

Do i need to make a reference to a DLL if so which one? I take it the loadPicture is a vba function correct me if i am wrong.

Any help would be much appreciated.

Thanks

Mo
 
You must reference the OLE Automation library.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top