View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Molyneaux Mike Molyneaux is offline
external usenet poster
 
Posts: 17
Default sharing violation while saving file after adding this macro

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