sharing violation while saving file after adding this macro

M

Mike Molyneaux

Running XP Pro, Office 2003 all with latest updates installed.

Attempting to write macro to export a module from current workbook, then
import to another workbook that is also open.

Got the following code from CPearson's site:

Dim FName as string
With Workbooks("Book2")
fName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export.FName
End With

Workbooks("Book1").VBProject.VBComponents.Import FName

code executes just fine, exporting, then importing 'module1'

Attempts to save either workbook generates a 'Sharing violation' message.

I've tried 'Save As' to a new file name to my local drive, no luck.

Any help would be appreciated.

Thanks Mike
 

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