can not save if this code is in the workbook

J

jlclyde

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top