Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all
Can anybody tell me what's wrong with the following code? Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) ActiveWorkbook.SaveCopyAs ("L:\test1.xls") Application.EnableEvents = False Workbooks.Open ("L:\test1.xls") With Workbooks("test1.xls").VBProject.VBComponents ("ThisWorkbook").CodeModule .DeleteLines 1, .CountOfLines End With Workbooks("test1.xls").Close savechanges:=True ActiveWorkbook.SaveCopyAs ("L:\test2.xls") Application.EnableEvents = True End Sub I would expect to get two files: test1.xls with the above code deleted, test2.xls with the code in place. However, I get two files with the code deleted! Is there a logical explanation to this? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) |