Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3303286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:56:28+00:00 2026-05-17T20:56:28+00:00

Currently, my VBA code creates a single file for each note. Here’s some simplified

  • 0

Currently, my VBA code creates a single file for each note. Here’s some simplified sample code:

Sub saveNotes()
   Set myNote = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderNotes)
   For ibi = 1 To myNote.Items.Count
     fname = myNote.Items(ibi).Subject
     myNote.Items(ibi).SaveAs "C:\Temp\" & fname & ".txt", 0
   Next
End Sub

Instead of creating a single file for each note, I want to create a single file for all the notes. I’m looking for the most efficient method to concatenate these note’s content and write them to a single file.

To give you an idea of the amount of data and how efficient it should be, there are hundreds of notes with an average size of 1024 chars.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:56:28+00:00Added an answer on May 17, 2026 at 8:56 pm

    This code will open a text file for output and write the modified time and body of each note into the text file. The file will be in your My Documents folder and will be named AllNotesYYYYMMDD.txt. You might change that path based on your operating system and where you actually want the file stored.

    Sub SaveNotes()
    
        Dim fNotes As MAPIFolder
        Dim ni As NoteItem
        Dim sFile As String
        Dim lFile As Long
    
        Set fNotes = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderNotes)
        lFile = FreeFile
        sFile = Environ$("USERPROFILE") & "\My Documents\AllNotes" & Format(Date, "yyyymmdd") & ".txt"
    
        Open sFile For Output As lFile
    
        For Each ni In fNotes.Items
            Print #lFile, "Modified:" & vbTab & ni.LastModificationTime & vbNewLine & ni.Body
            Print #lFile, "-------------------------------"
        Next ni
    
        Close lFile
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a code in VBA to retrieve prices for some financial models.
I currently have some VBA code that runs through and modifies all my calendar
I have an Excel file that has a bunch of VBA and macro code
I've writen an Excel-based, database reporting tool. Currentely, all the VBA code is associated
I am currently working on a project to convert a number of Excel VBA
Currently I'm doing some unit tests which are executed from bash. Unit tests are
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.
I have been trying to make a VBA code to do the following. I
The use of lockWindowUpdate API in VBA code avoids screen flickering when updating screen
I have written some SAS code that calls R via the x command (I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.