Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default delete userforms in vba

Hey everyone,
I'm trying to get rid of a form I created in a project so I can
import another one which has the same name.
But so far I havent been able to find a way to do it.
So please let me know if thats possible and if not what would be the
solution to my problem.

Thx

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default delete userforms in vba

In the code window, right-click on the user-form name in the left column and
select "Remove Userform".
--
Best wishes,

Jim


"malpropio" wrote:

Hey everyone,
I'm trying to get rid of a form I created in a project so I can
import another one which has the same name.
But so far I havent been able to find a way to do it.
So please let me know if thats possible and if not what would be the
solution to my problem.

Thx


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default delete userforms in vba

in the project explorer in the VBE, right click on you userform entry under
the appropriate workbook and select remove.

--
Regards,
Tom Ogilvy


"malpropio" wrote:

Hey everyone,
I'm trying to get rid of a form I created in a project so I can
import another one which has the same name.
But so far I havent been able to find a way to do it.
So please let me know if thats possible and if not what would be the
solution to my problem.

Thx


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default delete userforms in vba

Thk u Tom and Jim,
But I don't know if its because I'm using the vb code editor of excel
but when I right click on the userform in the project explorer it does
not give me the choice to delete it.

malpropio

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default delete userforms in vba

You must right click on the form you want to remove, not just in the project
window.

"malpropio" wrote:

Thk u Tom and Jim,
But I don't know if its because I'm using the vb code editor of excel
but when I right click on the userform in the project explorer it does
not give me the choice to delete it.

malpropio




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default delete userforms in vba

If you want to do this by code, set a reference to the VBA 5.3 Extensibility
Library (in VBA, go to the Tools menu, choose References, and check
"Microsoft Visual Basic For Applications Extensibility Library 5.3"). Then
use code like

Sub DeleteForm()
Dim VBComps As VBIDE.VBComponents
Dim VBComp As VBIDE.VBComponent
Set VBComps = Workbooks("Book1.xls").VBProject.VBComponents
Set VBComp = VBComps("UserForm1")
VBComps.Remove VBComp
End Sub

See www.cpearson.com/excel/vbe.htm for more details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"malpropio" wrote in message
oups.com...
Hey everyone,
I'm trying to get rid of a form I created in a project so I can
import another one which has the same name.
But so far I havent been able to find a way to do it.
So please let me know if thats possible and if not what would be the
solution to my problem.

Thx



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default delete userforms in vba

Or, simpler, without needing a library reference:

Sub DeleteForm()
With Workbooks("Book1.xls").VBProject.VBComponents
.Remove .Item("UserForm1")
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Chip Pearson" wrote in message
...
If you want to do this by code, set a reference to the VBA 5.3
Extensibility Library (in VBA, go to the Tools menu, choose References,
and check "Microsoft Visual Basic For Applications Extensibility Library
5.3"). Then use code like

Sub DeleteForm()
Dim VBComps As VBIDE.VBComponents
Dim VBComp As VBIDE.VBComponent
Set VBComps = Workbooks("Book1.xls").VBProject.VBComponents
Set VBComp = VBComps("UserForm1")
VBComps.Remove VBComp
End Sub

See www.cpearson.com/excel/vbe.htm for more details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"malpropio" wrote in message
oups.com...
Hey everyone,
I'm trying to get rid of a form I created in a project so I can
import another one which has the same name.
But so far I havent been able to find a way to do it.
So please let me know if thats possible and if not what would be the
solution to my problem.

Thx





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default delete userforms in vba

I didn't say to right click on the userform itself. Re read my post.

All actions are performed in the project explorer window (defaults to the
upper left of the VBE). You right click on the name of the Useform as
shown in the project explorer.

--
Regards,
Tom Ogilvy

"malpropio" wrote in message
oups.com...
Thk u Tom and Jim,
But I don't know if its because I'm using the vb code editor of excel
but when I right click on the userform in the project explorer it does
not give me the choice to delete it.

malpropio



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need some help with userforms T.c.Goosen1977 Charts and Charting in Excel 0 June 30th 06 09:29 AM
I need some help with userforms T.c.Goosen1977 Excel Discussion (Misc queries) 0 June 30th 06 09:27 AM
Two Userforms MBlake Excel Programming 4 April 25th 05 07:23 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM
Delete Modules and Userforms Peter Pantus Excel Programming 1 September 26th 03 08:17 PM


All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"