Background:
I have a script that iterates through emails (without any emails being selected) in an Outlook folder saving their attachments to the desktop.
Issue:
The attachment is a zip-file and I wonder if it is possible to save the decompressed file within (an .xls file) to the desktop instead?
Thank You!
The Outlook object model doesn't provide any method for that. You need to save the attached file on the disk and then unzip it programmatically.
If you try to use any search engine you can find the following links with a sample code:
VBA - Unzip files using VBA
Macro to Unzip Files - It's Just Creating Empty Folders
Unzip file(s) with the default Windows zip program (VBA)
Related
I'm trying to access Outlook attachments from clipboard using VBA to further process the file.
The user copies an attachment to the clipboard (Right click -> Copy), opens PowerPoint, clicks a buttons and gets the presentation inserted a the end of the document.
The key part seems to access the PowerPoint file in the clipboard an save it on the file system.
Can someone help and provide a sample code for this using VBA in PowerPoint?
Many thanks!
I've found a way achieve it.
Getting filenames: Solution has been posted here: http://www.access-o-mania.de/forum/index.php?topic=17045.15
Getting the content
file size in clipboard can be obtained by GlobalSize(handle)
pointer the by GlobalLock(handle)
content using CopyMemory(destination, source, length)
Look at the clipboard contents with an app like ClipSpy. Since there is no physical file to be copied, the full file path is not included (no CF_HDROP format). But FileGroupDescriptor and FileContents formats are there.
I need a macro script to:
Convert/Print email body to PDF file
Save that file to a folder
Delete the email after
I'm pretty clueless on using scripts/macros on outlook. Would need step by step process if possible. I do have adobe program for converting installed.
You can save the message as a DOC file (OlSaveAsType.olDoc), then use the Word Object Model to convert it to PDF.
I have 100 images in a folder. I want to create folders with names like
PC0001,PC0002.....PC0100 and transfer one image into each of these folders.
Can I do that using VBA in Excel
Achievable in VBA.
Use these functions in your attempt at this exercise:
Copy file in VBA
Create directory in VBA
Iterate all files (images) in directory
Delete old file (image) in VBA
Post your code on StackOverflow and we will be sure to help.
I have a report that is built off of an excel macro that is triggered when the file is opened. I use a Windows Scheduled Task to open the file which triggers the macro and then closes the file.
As part of the process within this marco one of the worksheets is saved as PDF file to our network. This file is then linked to through our sharepoint site. It appears that if someone is viewing this pdf and the macro is triggered it doesn't update the PDF File since it is opened. I am handling this error by saving a backup file to a different folder with a different name.
I'm trying to find a good way to work around this. Is there a way to export and save the PDF as read only through the excel vba? Is there a setting in Sharepoint that would make the file open as Read Only?
Any suggestions would be greatly appreciated.
Thanks in advance.
I am attempting to create a PST with a sample of MSGs.
Rather than dragging and dropping into the desired folders, does the Outlook.MAPIFolder in (VBA) provide a way to add a .MSG file from the file system into an Outlook folder (I do not want to recreate the MSG, something akin to drag and drop into a folder).
My simple use case is
I have a file someEmail.msg on my local file system in a folder say
c:/someLocalFileSystemFolder
In Outlook I have a pst folder say somePSTFolder
I want to import someEmail.msg into somePSTFolder such that the
structure is
somPSTFolder
+ someLocalFileSystemFolder
+ + someEmail.msg
I have managed to recreate my local file system folder structure into the pst folder structure using VBA. Is it possible to import msgs programmatically?
Consider using the .Move method, documented here:
http://msdn.microsoft.com/en-us/library/office/ff860683(v=office.15).aspx
Whether the message is re-created, I am not certain. If so, you could always simply delete it from the source if you no longer need it.