Run-time error '-2147418113 (8000ffff)':

D

Dave D-C

' Run-time error '-2147418113 (8000ffff)':
' Automation error

' I'm posting this to get it into the archives.
' I got this error and a search wasn't helpful.
' This is a simplified source of the error.
' Briefly, the error is in referencing an image
' that has been deleted/removed/destroyed/?.
' (Don't say it was a stupid thing to do --
' I've made it look simple)
' This assumes a UserForm1. Click it to run.
' D-C Dave XL97/WIN98

Sub Main()
UserForm1.Show
End Sub

Private Sub UserForm_Click() ' (in UserForm1)
Dim mpg1 As MultiPage, img1 As Image
Stop ' if you want to look
If img1 Is Nothing Then Beep ' ck
' create a multipage
Set mpg1 = UserForm1.Controls.Add("forms.multipage.1", "Multi1",
True)
' remove 2nd page
mpg1.Pages.Remove (1)
' create image on the multipage
Set img1 = mpg1.Pages(0).Add("forms.image.1", "Image1", True)
' img1 is nothing or something
If Not img1 Is Nothing Then img1.Tag = "X"
' remove last page
' image1 goes to ..? but VBA handles well
mpg1.Pages.Remove (0)
' img1 is worse than nothing
' It still points somewhere
If Not img1 Is Nothing Then img1.Tag = "Y" ' error
' so next time try to remember that img1 is a pointer
Set img1 = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top