ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dynamically loading external macros, on the fly (https://www.excelbanter.com/excel-programming/356384-dynamically-loading-external-macros-fly.html)

sp00nix[_25_]

dynamically loading external macros, on the fly
 

I'm am trying to create somewhat of a scripting scheme so that the en
user can format their reports, but not be limited to just what m
scripting scheme offers. Basically, i want people who are not familia
with the macro side of excel to still be able to do powerful things
such as customization.

In order to complete this project, i imagine i will need to load .ba
files, or text files containing macros on the fly.

If i have a directory called "\scripts", how can i run a text file i
that directory as a macro?

thanks,
sp00

--
sp00ni
-----------------------------------------------------------------------
sp00nix's Profile: http://www.excelforum.com/member.php...nfo&userid=393
View this thread: http://www.excelforum.com/showthread.php?threadid=52381


Tom Ogilvy

dynamically loading external macros, on the fly
 
From Chip Pearson's site - shows how to export to a text file, then import
into another workbook.

Sub CopyOneModule()

Dim FName As String
With Workbooks("Book2")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With

' --- line your looking for ---
Workbooks("book1").VBProject.VBComponents.Import FName

End Sub

http://www.cpearson.com/excel/vbe.htm

--
Regards,
Tom Ogilvy


"sp00nix" wrote in
message ...

I'm am trying to create somewhat of a scripting scheme so that the end
user can format their reports, but not be limited to just what my
scripting scheme offers. Basically, i want people who are not familiar
with the macro side of excel to still be able to do powerful things,
such as customization.

In order to complete this project, i imagine i will need to load .bas
files, or text files containing macros on the fly.

If i have a directory called "\scripts", how can i run a text file in
that directory as a macro?

thanks,
sp00n


--
sp00nix
------------------------------------------------------------------------
sp00nix's Profile:

http://www.excelforum.com/member.php...fo&userid=3934
View this thread: http://www.excelforum.com/showthread...hreadid=523810




sp00nix[_26_]

dynamically loading external macros, on the fly
 

thanks to

--
sp00ni
-----------------------------------------------------------------------
sp00nix's Profile: http://www.excelforum.com/member.php...nfo&userid=393
View this thread: http://www.excelforum.com/showthread.php?threadid=52381



All times are GMT +1. The time now is 03:38 PM.

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