View Full Version : Solved: Automatically import a .bas module
Jacob Edison
04-08-2011, 06:43 PM
Hi All,
:help :help
Is there macro in excel to import a .bas module that i have exported and saved on my desktop
Thanks in advance for all the help
Regards
Jacob
mancubus
04-09-2011, 02:26 AM
hi.
see this.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=885
mancubus
04-09-2011, 02:27 AM
Option Explicit
'http://www.tech-archive.net/Archive/Excel/microsoft.public.excel/2009-03/msg00695.html
Sub testme()
Dim VBProj As Object 'VBIDE.VBProject
Dim myFileName As String
myFileName = "C:\My Basic Modules\ParseOutNames.bas"
Set VBProj = Nothing
On Error Resume Next
Set VBProj = ActiveWorkbook.VBProject
On Error GoTo 0
If VBProj Is Nothing Then
MsgBox "Can't continue--I'm not trusted!"
Exit Sub
End If
VBProj.vbcomponents.Import myFileName
End Sub
Jacob Edison
04-09-2011, 07:52 AM
Thanks Mancubus!
I will try this out.
I'll be back to let u know if it worked...
:beerchug:
Jacob Edison
04-09-2011, 11:59 AM
That worked perfectly...
Thank a lot Mancubus.. :super:
mancubus
04-09-2011, 01:18 PM
wellcome.
btw, the only thing i did was pasting the kb link and the code from tech-archive.net.
:beerchug:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.