vba script to copy the code from text file to ThisoutlookSession module - vba

i want to copy the code from text file into the "Thisoutlooksession" module in outlook through vba script ,i am not able to find the way .
is there any way to do it ?

Related

Open the specific folder by usig Excel VBA code?

I got difficulties with VBA code.
I have a Excel file named Database for GL and I want activate this file by using VBA code then I want to Vlookup some information from this file to my current working file.
I have the directory for file.
C:\Users\user\Desktop\Avromed QSC\GL_Analysis
Avromed QSC - is file folder
GL_Analysis - is file folder
Database for Gl - is excel file.
Please, help me to define proper VBA code for this action.

How to save as excel and vba project for future use?

How can I save as xlsx my project?
I try to do my project in excel with vba but I do know how to save it for future use.
If I save as excel sheet, vba will not be saved to it, I do know how to do that save.
Is there someone who has an idea to this problem?
Please anyone can help me.
xlsx only for data sheet. When you have VBA code in your excel workbook you should save as Excel Macro-Enabled workbook (*.xlsm)
Hello Schadrack Rurangwa**,
There a couple ways to do this.
Altenative One:
save the vba file to ".bas"
1. Click on menu Tools->Macro->Visual Basic Editor
2. This will open Visual Basic Editor
3. In the visual basic editor, select menu File-> Rightclick somewhere in the module and select export file. (save your module ".bas" somewhere).
Next time you start excel and want to use your VBA-Macro, just navigate to:
Tools>Macro->Visual Basic Editor> Rightlclick somewhere in the module and import the ".bas" file.*
Altenative two:
You could save the file Excelfile as "*.xlsm"
(A file with the XLSM file extension is an Excel Macro-Enabled Workbook file)
Macros can be stored in individual workbooks or available for a user in all workbooks opened if they are stored in C:\Users\nnn\AppData\Roaming\Microsoft\Excel\XLSTART\ PERSONAL.XLSB.
For more info see https://support.office.com/en-us/article/create-and-save-all-your-macros-in-a-single-workbook-66c97ab3-11c2-44db-b021-ae005a9bc790

How do i save a text attachment form a specific outlook folder to file. using Excel VBA

I am still kinda new to VBA, and this is a little outside my depth. I have found this thread here Save attachments to a folder and rename them but I feel like this is more code then I need, and it confuses me -.- . All i need to do is save a text file from a specific folder in outlook to a file on my local disk.
As per the comment above the code is easier than first looks, I would recommend to take some time going through that solution, you can step through the code using F8 and hovering over variables details what they have been resolved to. This helps to breakdown seemingly difficult code.
Copying a specific file is easy to do with something like FileCopy?
Sub Copy_File()
FileCopy "C:\SourceFolder\Test.txt", "C:\Users\DestFolder\Test.txt"
End Sub
(Code should be run in vba editor - shortcut ALT+F11 - then copy code in new module and use F8 to step through)

Install a Macro With a Batch File

I have a macro for Word that I would like to share with people, I want to create a batch file that installs the macro into word and assign it to a button.
Here is the batch file I have right now:
copy "Collapse.dotm" = "%appdata%\Microsoft\Word\STARTUP"
"%programfiles(x86)%\Microsoft Office\Office15\Winword.exe" /mCollapse
First the batch script copies the macro to the Word Startup folder. Then the script launches word, I ran the script and it is telling me it can't copy the macro.
EDIT: The error message was that Word could open up the template, I changed the extension to .dot instead of .dotm. With that change the script runs without errors, the template can be seen in the VBA Editor but doesn't create a macro.
EDIT 2: It creates a new project in the VBA that is unviewable though.

runing the macro automatically to all existing and new documents

I have macro that create the footer with author and date, but I need this macro to automatically run to all word document (existing and the new document) just I open the word file which I saved before or the new one so there we find in document the macro that I create
save your macro file as a word addin file or put your macro in your personal.doc file and will be available for all files.
Store it in ThisDocument as OnCreate method ("Private Sub Document_NewDocument" if I remember well). Save it as Normal.dotm template, so it will automatically call it created document. You can also store it as OnOpen, and start your macro from removeing footer - this way all documents you open will get your footer.