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: 124
Default Deleting code in a file with code..

Hi ,
I am running this bit of code below from an addin file that deletes the code
in Sheet 1 of the active workbook.
It works fine..except for the Save part.
After I run this codes and file closes... I open the file back up and it
prompts to enable macros... There are no macros in the workbook anymore (i
checked)... and if I click on the Save button in Excel, close that file, and
then open it up again.. it doesn't prompt to enable macros..
I need to be able to run this code.. have the file save and close and then
when it's opened back up.. the enable macro message will not appear
..
The only way I have been able to get this to work is by taking out the
"activeworkbook.close" section of the code and then..after the code runs.. I
click the Save button in Excel and then close it myself.

Does anyone know why this is happening???




If ActiveWorkbook.VBProject.vbComponents("Sheet1").Co demodule.CountofLines
0 Then
With ActiveWorkbook.VBProject.vbComponents("Sheet1").Co demodule
.DeleteLines 1, .CountofLines
End With
Else
MsgBox prompt:="No Code to Delete!"


End If
Activeworkbook.Save
Activeworkbook.Close true

End Sub

Thanks in advance for your help...
Kimberly


 
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
Deleting row using vb code? hol Excel Discussion (Misc queries) 4 November 30th 07 02:43 PM
VBA Code for Deleting a Row [email protected] Excel Worksheet Functions 3 September 6th 07 03:23 PM
deleting selected worksheets using vb code George Excel Discussion (Misc queries) 1 October 31st 06 05:14 PM
Deleting Workbook_Open code Paige Excel Discussion (Misc queries) 3 January 31st 06 07:39 PM
Deleting Code from VBA Noemi Excel Discussion (Misc queries) 1 January 24th 06 08:55 AM


All times are GMT +1. The time now is 09:45 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"