Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2003, 09:33 AM
Authorized User
 
Join Date: Jun 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically Adding Controls - Error

I am dynamically adding an ActiveX control to a UserForm using the call:
    Set MyObject = Me.Controls.Add("ControlName.ProgID", "MyName")

where MyObject is dimmed to an Object.

When I close Excel, it crashes, with the standard "Microsoft Excel has encountered a problem and needs to close. We are sorry for the inconvenience" error message.

Is there something I need to do to unload this control on UserForm.Terminate?

Thanks,
Paul
 
Old August 28th, 2003, 01:59 AM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could try using
set myobject = nothing
before you close the form.

Kieran





Similar Threads
Thread Thread Starter Forum Replies Last Post
Events - Adding Dynamically dash dev C# 2005 2 December 5th, 2007 02:05 PM
Adding Controls Dynamically andyj00 C# 0 March 19th, 2007 08:54 AM
dynamically adding objects shawnvb VB How-To 3 February 14th, 2007 03:12 PM
Problem in adding controls dynamically vivekshah C# 0 April 13th, 2006 08:35 AM
Dynamically created controls katsarosj ASP.NET 1.0 and 1.1 Basics 4 February 4th, 2004 09:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.