Hello everyone and thank you for reading my post. I am having trouble importing a module (VBA macro). I have two excel workbooks open one is host, the other is export. The export workbook is a copy of a worksheet originating from the host workbook. The first part of my code works fine:
Workbooks(Host).Activate
ActiveWorkbook.VBProject.VBComponents("ResetXFER1").Export ("C:\ResetXFER1.bas")
then I make the export workbook active and try to import the module like this:
Workbooks(NWBN).Activate: Sheets("Upload_Template").Select
Application.VBE.ActiveVBProject.VBComponents.Import ("C:\ResetXFER1.bas")
and it imports into the Host instead of NWBN. I suppose activating a workbook is not the same as activating the VBProject, but that's just a guess. In short, the import works but imports into the wrong workbook. Can anyone suggest how to import into NWBN.
Many thanks to all,
Roger
Bookmarks