Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveAs without copying Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveAs without copying Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default SaveAs without copying Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default SaveAs without copying Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveAs without copying Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default SaveAs without copying Macro

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
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
SaveAs in Macro gfkbob[_2_] Excel Discussion (Misc queries) 2 April 12th 07 10:52 PM
SaveAS macro Query Nigel Excel Discussion (Misc queries) 1 May 13th 05 01:17 PM
Saveas Macro Nigel Excel Discussion (Misc queries) 3 May 11th 05 01:15 PM
SaveAs Macro Help? NeuralNetwork Excel Programming 4 December 23rd 03 04:17 PM
Error on SaveAs Macro Kevin Excel Programming 1 December 3rd 03 03:58 AM


All times are GMT +1. The time now is 12:31 AM.

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"