Load VBA code from a text file

If you want to import source code from a text file, you can use the following code.

Sub fromTextFile()

Dim CodeModul As CodeModule

Dim i As Integer

Const Importfile = "c:\Macro.txt"

 

Set CodeModul = ThisWorkbook.VBProject.VBComponents("NewModule").CodeModule

 

With CodeModul

.AddFromFile Importfile

End With

End Sub

author.


I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.

Analysis Office - The Comprehensive Guide 3rd edit
Analysis Office - The Comprehensive Guide is a pdf book about SAP BusinessObjects Analysis Office. It is based on Analysis Office 2.6 and contains 272 Pages.
49,99 €
Analysis Office - The Comprehensive Guide 2nd edit
Analysis Office - The Comprehensive Guide is a pdf book about SAP BusinessObjects Analysis Office. It is based on Analysis Office 2.4 and contains 243 pages.
39,99 €
Analysis Office - The Comprehensive Guide
Analysis Office - The Comprehensive Guide is a pdf book about SAP BusinessObjects Analysis Office. It is based on Analysis Office 2.3 and contains 227 Pages.
9,99 €

Write a comment

Comments: 0