ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sharing violation while saving file after adding this macro (https://www.excelbanter.com/excel-programming/354758-sharing-violation-while-saving-file-after-adding-macro.html)

Mike Molyneaux

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



All times are GMT +1. The time now is 12:35 PM.

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