Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
The very strange things happens. In my VBA code I let the program delete alle my modules (no problem). At the end of the code i put th SaveAs function. This is all no problem (the modules are deleted) , but when I open th new file (the one that was saved) i get the message: this file contain macro's. ???? very strange for all modules were deleted. When I chec the macro, it is the one that i runned before. Now, the problem is solved when i leave out the DisplayAlerts function but i don't want to leave this out. Can anybody help me? If you understand what I mean anyway. Thanks in advance -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this is the code
Set VBComp = ThisWorkbook.VBProject.VBComponents_("Module1") - i i save now (manually) there are no problems ActiveWorkbook.SaveAs Filename:="C:\temp\file.xls" FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Application.ScreenUpdating = True End Sub when i open file.xls it will display the message enable / disabl macro's how is that possible -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Martijnhj,
Where the code to delete the modules ? Code behind worksheets also count as macros. NickHK "Martijnhj " wrote in message ... this is the code Set VBComp = ThisWorkbook.VBProject.VBComponents_("Module1") - if i save now (manually) there are no problems ActiveWorkbook.SaveAs Filename:="C:\temp\file.xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Application.ScreenUpdating = True End Sub when i open file.xls it will display the message enable / disable macro's how is that possible? --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try windows.close
Sub CloseSelectedWorkbook() On Error GoTo nn Application.DisplayAlerts = False workbookname = ActiveCell.Value Windows("" & workbookname & ".xls").Close Range("C3").Select Application.DisplayAlerts = True nn: End Sub -- Don Guillett SalesAid Software "Martijnhj " wrote in message ... this is the code Set VBComp = ThisWorkbook.VBProject.VBComponents_("Module1") - if i save now (manually) there are no problems ActiveWorkbook.SaveAs Filename:="C:\temp\file.xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Application.ScreenUpdating = True End Sub when i open file.xls it will display the message enable / disable macro's how is that possible? --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nick,
Thanks for your reaction. this is the code for deleting the module Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1") ThisWorkbook.VBProject.VBComponents.Remove VBComp and then the rest... -- Message posted from http://www.ExcelForum.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Martijnhj,
Not sure, bit is it possble to remove the module from which the "remove module" code running ? NickHK "Martijnhj " wrote in message ... Hi Nick, Thanks for your reaction. this is the code for deleting the module Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1") ThisWorkbook.VBProject.VBComponents.Remove VBComp and then the rest.... --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SaveAs in Macro | Excel Discussion (Misc queries) | |||
SaveAS macro Query | Excel Discussion (Misc queries) | |||
Saveas Macro | Excel Discussion (Misc queries) | |||
SaveAs Macro Help? | Excel Programming | |||
Error on SaveAs Macro | Excel Programming |