MikeMcEvoy
asked on
VBA to Import Module
Hello,
I just need a simple vba script that will import module "C:\Documents and Settings\mm31896\Desktop\M odule4.bas ".
I've tried a few examples that I found by searching previous answers but they all seem to kick out run time errors. Any help would be greatly appreciated.
I just need a simple vba script that will import module "C:\Documents and Settings\mm31896\Desktop\M
I've tried a few examples that I found by searching previous answers but they all seem to kick out run time errors. Any help would be greatly appreciated.
'This is an example of attempt that kicks out a runtime error.
Sub AddBasFile()
ThisWorkbook.VBProject.VBComponents.Import _
Filename:="C:\Documents and Settings\mm31896\Desktop\Module4.bas"
End Sub
There is probably something wrong with the import file. Can you post it? Do you already have a module with the same name? What is the error?
Kevin
Kevin
ASKER
The import file seems to be ok. It actually contains code that you helped me with a few days ago (It's attached).
The Error is "Method VBProject' of object'_Workbook' failed"
I looked at Chip Pearson's site and have not been able to figure it out.
Module4.txt
The Error is "Method VBProject' of object'_Workbook' failed"
I looked at Chip Pearson's site and have not been able to figure it out.
Module4.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect Thanks!
Saurabh thanks for your suggestion as well.
Saurabh thanks for your suggestion as well.
http://www.cpearson.com/Excel/vbe.aspx
Saurabh...