LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Delete a module

I am tring to delete a module from excel using VBA. I have figured out how to
do this within the body of the Macro, but my problem comes in when I want to
link this to a macro that also saves the file to a directory on my computor
and also sends the workbook out as an attachment to a list of users.

This is what I got so far:

Sub Sendout()

'Saveas
Dim VBComp As Object

Dim FName As Variant
FName = Application.GetSaveAsFilename( _
filefilter:="Excel files (*.xls),*.xls")
If FName = False Then
' user clicked cancel
Else
ThisWorkbook.Saveas Filename:=FName
End If

'Rank
Range("A3:S32").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select

ActiveWorkbook.Save

'Mailworkbook
Dim MyArr As Variant
MyArr = Sheets("Championship").Range("EmailNames")
ActiveWorkbook.SendMail MyArr, "Curtour Results"

Set VBComp = ThisWorkbook.VBProject.vbcomponents("Module1")
ThisWorkbook.VBProject.vbcomponents.Remove VBComp

ActiveWorkbook.Save

'DeleteMOD
Dim MyArr As Variant
MyArr = Sheets("Championship").Range("EmailNames")
ActiveWorkbook.SendMail MyArr, "Curtour Results"
End Sub

Any suggestions?
--
Pete
 
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
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 1 June 22nd 05 01:12 AM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:16 PM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:11 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:54 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM


All times are GMT +1. The time now is 04:19 PM.

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

About Us

"It's about Microsoft Excel"