ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   can not save if this code is in the workbook (https://www.excelbanter.com/excel-discussion-misc-queries/214036-can-not-save-if-code-workbook.html)

jlclyde

can not save if this code is in the workbook
 
I am not sure what the problem is with this code. If this code is
present in any workbook, it will not let me save the file. It says
they may be a problem with the read writes, but this is not true since
I can save it willout the macro just fine. Any help would be greatly
appreciated.

Thanks,
Jay

Sub CopyOneModule()

Dim FName As String
With ThisWorkbook
FName = .Path & "\code.txt"
.VBProject.VBComponents("modTest").Export FName
End With
ThisWorkbook.VBProject.VBComponents.Import FName

End Sub


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com