View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Xentis Xentis is offline
external usenet poster
 
Posts: 5
Default Running macro automatic after opening Userform

Mike,

Thanks for your answer. It is better to use the call option.

In this case however I get a "Object variable or with block variable
not set"

I can't seem to get the first macro to recognize the image field in
the form. I 've now tried the code below
But it also gives a "Object required" error.

-----------------------------------------------------------------------
---------------
Public Sub ShowPicture()

Dim CurrentChart1, Fname1

Set CurrentChart1 = Sheets("Picture").ChartObjects(1).Chart
Fname1 = ThisWorkbook.Path & "\temp1.gif"
CurrentChart1.Export Filename:=Fname1, FilterName:="GIF"

UserForm1.Show vb Modeless

Path1 = "c:"
Fname1 = Path1 & "\temp1.gif"
Image1.Picture = LoadPicture(Fname1)

End Sub

-----------------------------------------------------------------------
--------------------

I'm not very experienced with this kind of problems so if anybody
could help I would be really glad.

Regards,

Xentis