+ Reply to Thread
Results 1 to 2 of 2

VBA to extract zip file attachments AND extract time stamp data from .msg file

  1. #1
    Registered User
    Join Date
    08-11-2020
    Location
    US
    MS-Off Ver
    2013
    Posts
    1

    Question VBA to extract zip file attachments AND extract time stamp data from .msg file

    Hello I'm having issues running a VBA code and I don't know if it's because the file folders are to a OneDrive or maybe the code isn't able to extract zips, I'm at a loss. I am super new to VBA and through my research I found this VBA code. I get bugs and it doesn't run at the 'MkDir' line. I don't need to make a new folder, I have the messages all saved in a folder location and I want the zip files extracted and put into another location but retitled with the time stamp of the message. I'm not sure if it's possible, but if anyone has information that would be great.

    Thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: VBA to extract zip file attachments AND extract time stamp data from .msg file

    You may believe you need to do this in VBA in Excel, but you don't. You could use Notepad to edit the code, save it as a .VBS file, and run it from a console command line.

    You're actually using Windows Script Host (WSH) object methods. In my opinion, you'd be better off working out this procedure in VBScript at a command line prompt with CSCRIPT.EXE. Indeed, having the .VBS file in a text editor and running it in a separate console window would be a more efficient development environment because it'd be a lot easier to list directory contents after running the script.

    I'm not sure WSH plays well with OneDrive. WSH is rather old at this point, considerably older than OneDrive. OTOH, WSH can handle .zip files.

    it doesn't run at the 'MkDir' line. I don't need to make a new folder
    Then comment out the MkDir line if you don't need to create new directories in E:\. BTW, if you don't have an E: drive, or you lack system permissions to create directories in E:\, those'd be the likeliest explanation why that statement is failing.

    Since this task isn't really spreadsheet or Office related, this may be easier to do with a batch file. Seems like you have a folder which contains .msg files and possibly also subfolders also containing .msg files. You want to extract the file attachments from the .msg files, and save them in some other folder (which doesn't seem to be strAttachmentFolder given your statement above), and if the file attachment were a .zip file, extract all its files to that other directory.

    You have a potential problem. Different .msg files, if from different senders, could have the same date-time stamp and file attachments with the same filename. Alternatively, you could have multiple .zip file attachments in the same .msg file which each contain files with the same filenames. How should that be handled?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract data from multi users file in a single file
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2019, 12:54 PM
  2. extract time stamp from link
    By ctguards1987 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2014, 04:35 PM
  3. Help building a macro to extract data from one file into another different file
    By awbrownicm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2014, 07:56 PM
  4. [SOLVED] Wanted to extract data from a file which is already an excel macro file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2013, 11:43 AM
  5. Extract Time from a NOW Stamp
    By Dave69rock in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-08-2013, 06:30 PM
  6. How to extract Information from an Excel File and entering those data in a text file?
    By bikash.nitk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2012, 12:13 PM
  7. Replies: 1
    Last Post: 07-31-2011, 08:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1