Running scripts with Outlook 2013

Status
Not open for further replies.

vze2mp9g

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
I found a script (I THINK that it's a Visual Basic Script, not sure) on an Outlook forum, which Diane Poremsky is on, and I was wondering how I can use/run it in Outlook 2013. What should be the ending of the script? Here is one of the smaller scripts:

PHP:
Option Explicit 
 
Public Enum olSaveAsTypeEnum
 olSaveAsTxt = 0
 olSaveAsRTF = 1
 olSaveAsMsg = 3 
 
End Enum 
 
Private WithEvents Items As Outlook.Items 
 
Private Const MAIL_PATH As String = "d:\e-mails\" 
 
Private Sub Application_Startup()
 Dim Ns As Outlook.NameSpace
 Set Ns = Application.GetNamespace("MAPI")
 Set Items = Ns.GetDefaultFolder(olFolderInbox).Items 
 
End Sub 
 
Private Sub Items_ItemAdd(ByVal Item As Object)
 If TypeOf Item Is Outlook.MailItem Then
   SaveMailAsFile Item, olSaveAsMsg, MAIL_PATH
 End If 
 
End Sub 
 
Private Sub SaveMailAsFile(oMail As Outlook.MailItem, _
 eType As olSaveAsTypeEnum, _
 sPath As String _ 
 
)
 Dim dtDate As Date
 Dim sName As String
 Dim sFile As String
 Dim sExt As String
 Select Case eType
   Case olSaveAsTxt: sExt = ".txt"
   Case olSaveAsMsg: sExt = ".msg"
   Case olSaveAsRTF: sExt = ".rtf"
   Case Else: Exit Sub
 End Select
 sName = oMail.Subject
 ReplaceCharsForFileName sName, "_"
 dtDate = oMail.ReceivedTime
 sName = Format(dtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
   vbUseSystem) & Format(dtDate, "-hhnnss", _
   vbUseSystemDayOfWeek, vbUseSystem) & "-" & sName & sExt
 oMail.SaveAs sPath & sName, eType 
 
End Sub 
 
Private Sub ReplaceCharsForFileName(sName As String, _
 sChr As String _ 
 
)
 sName = Replace(sName, "/", sChr)
 sName = Replace(sName, "\", sChr)
 sName = Replace(sName, ":", sChr)
 sName = Replace(sName, "?", sChr)
 sName = Replace(sName, Chr(34), sChr)
 sName = Replace(sName, "<", sChr)
 sName = Replace(sName, ">", sChr)
 sName = Replace(sName, "|", sChr) 
 
End Sub

Can anyone tell me if this saves all my new e-mails as text or just the ones I want?

Secondly, I've been noticing that I've been receiving a lot of errors in my send/receive dialog box (with RSS feeds only). Here is just one sample of the error:
Code:
[INDENT]Task 'RSS Feeds' reported error (0x800C0006) : 'Synchronization to RSS Feed:"http://www.linkedin.com/rss/questions?cat=PRO_CMA" has failed. 
 
Outlook cannot download the RSS content from http://www.linkedin.com/rss/questions?cat=PRO_CMA because of a problem connecting to the server.'[/INDENT]



I know that it's not connecting to the server, but why is this occurring, and how can I, if possible, correct this?

Lastly, this is a double loaded question. I have downloaded holidays from 2013-2022, how can I incorporate them into my Calendar in Outlook 2013, and do I need to call this file any special file, or can it just be a text file. Here is just a very small sample of the holiday list:

Code:
[United States] 264 
 
Christmas Day,2012/12/25 
 
Christmas Day,2013/12/25 
 
Christmas Day,2014/12/25 
 
Christmas Day,2015/12/25 
 
Christmas Day,2016/12/25 
 
Christmas Day,2017/12/25 
 
Christmas Day,2018/12/25 
 
Christmas Day,2019/12/25 
 
Christmas Day,2020/12/25 
 
Christmas Day,2021/12/25 
 
Christmas Day,2022/12/25

Now the other part. I have a list of appointments for Physical Therapy for three days a week for the next three months. Can anyone tell me what type of format does this file have to be in and how should it be set up? For example,

Thursday, June 6 2013 10:00 AM Physical Therapy with NovaCare (Theresa - Therapist)

Friday, June 7, 2013 11:00 AM Physical Therapy with NovaCare (Jeffery - Therapist)

Tuesday, June 11, 2013 11:00 AM Physical Therapy with NovaCare (Theresa - Therapist)

etc., etc., and so on.

Can I set up a text file, or what ever, and have them imported into Outlook's Calendar like the holidays?

I would really appreciate any and all assistance with these matters.

Thank You. :)
 
Thought I replied to this already. :(

The first one is saving all new messages as files. It should work in outlook 2013 as is. If you want to save only selected message, i have a macro here - Save email message as text file - Slipstick Systems - it saves as text, but can be tweaked to support other formats.

RSS: hard to say what is wrong. Is the url valid? It's 404'ing here.

Using the hol format sets the appt as all day, not timed. You can create a text file in excel, save as csv and import it.
 
Thought I replied to this already. :(

The first one is saving all new messages as files. It should work in outlook 2013 as is. If you want to save only selected message, i have a macro here - Save email message as text file - Slipstick Systems - it saves as text, but can be tweaked to support other formats.

So basically, I just have to run the macro within Outlook, can you clue me in on when and how to run this Macro when I'm viewing a message I want to save as a text file? Thank you, this will save me a lot of time!

RSS: hard to say what is wrong. Is the url valid? It's 404'ing here.

I have to get back to you on this, I don't think its 404'ing, but I'll try to copy the error in the error window

Using the hol format sets the appt as all day, not timed. You can create a text file in excel, save as csv and import it.

Okay, so I can have the text file and have the ending .HOL (international.HOL). Now, what about the appointments, do I have to manually add all them in, or can I use excel, and have a specific time?

Thank you, you've been a big help, as usual, which I don't take for granted.
 
Importing appointments:

Create a workbook in excel - use these field names and you won't need to map the fields -

Subject, Start Date , Start Time, End Date, End Time, All day event, Reminder on/off, Reminder Date, Reminder Time, Categories, Show time as

You don't need to use all of the fields, just the ones you need (and there are more, these are the most common). The yes/no fields use True and False or you can use a 1 for True.

Show time as is a number code - 3 is Free, 2 is Busy.

You can use the excel features for filling the cells then save as a csv file and import it in to Outlook.

On the macro: do you want to save all mail or just the selected ones?
 
Importing appointments:

Create a workbook in excel - use these field names and you won't need to map the fields -

Subject, Start Date , Start Time, End Date, End Time, All day event, Reminder on/off, Reminder Date, Reminder Time, Categories, Show time as

You don't need to use all of the fields, just the ones you need (and there are more, these are the most common). The yes/no fields use True and False or you can use a 1 for True.

Show time as is a number code - 3 is Free, 2 is Busy.

You can use the excel features for filling the cells then save as a csv file and import it in to Outlook.

On the macro: do you want to save all mail or just the selected ones?

Thank you for the form to use in Excel to for creating calendar events. Where can I see all the fields that are available so I can customize my data file even more than import them into Outlook Calendar.

This may be beyond your expertise, but I'll ask any how. Is there a way to sync Outlook's (2013) Calendar with the iCloud? Reason why I ask is because if you have a Gmail account you can sync your calendar.

On the Macro: I just want to save the selected ones, not all, or all new mail. How do I go about running the macro as only the selected one(s), would it be different if I was saving all the e-mails?

Lastly, regarding my RSS Feed errors, they are not 404'ing I think it's an unknown error. Here is what I was able to copy from the send/receive window:

PHP:
Task 'RSS Feeds' reported error (0x800C0006) : 'Unknown Error 0x800C0006' 
 
Task 'RSS Feeds' reported error (0x800C0006) : 'Synchronization to RSS Feed:"http://www.linkedin.com/rss/questions?cat=CAR_JOB" has failed. Outlook cannot download the RSS content from http://www.linkedin.com/rss/questions?cat=CAR_JOB because of a problem connecting to the server.' 
 
Task 'RSS Feeds' reported error (0x800C0006) : 'Unknown Error 0x800C0006' 
 
Task 'RSS Feeds' reported error (0x800C0006) : 'Synchronization to RSS Feed:"http://triumphmusic.com/feed/news/" has failed. Outlook cannot download the RSS content from http://triumphmusic.com/feed/news/ because of a problem connecting to the server.' 
 
Task 'RSS Feeds' reported error (0x800C0006) : 'Unknown Error 0x800C0006' 
 
Task 'RSS Feeds' reported error (0x800C0006) : 'Synchronization to RSS Feed:"http://www.linkedin.com/rss/questions?cat=PRO_CMA" has failed. Outlook cannot download the RSS content from http://www.linkedin.com/rss/questions?cat=PRO_CMA because of a problem connecting to the server.'

I know that there is a problem connecting to the server, but the other RSS feeds I get, from the same sites, I don't have any problems. Maybe unsubscribe and resubscribe to the RSS feeds? You guess is as good as mine.

Thank You.
 
The easy stuff first: paste the rss url in the address bar of your browser.

http:// www. linkedin. com/rss/questions?cat=CAR_JOB (the spaces are mine - I don't want the forum to convert it to link) - returns this:

HTTP Status 404 -

------------------------------------------------type Status report

message

description The requested resource is not available.

------------------------------------------------Apache Tomcat/6.0.36

If iCloud control panel is installed and configured, it should sync, but it doesn't work for everyone and you can't set it as default. CodeTwo is working on an addin that will do outlook to iCloud or gmail direct sync. I don't know the ETA on that though.

On the calendar events, export your calendar and you'll see the full list of default fields.

The macro you posted runs on all email as it arrives. The one linked to above does only the selected message (1 message). The code at SaveSelectedMailAsTxtFile.txt

is a tweaked version of my code that saves each selected message as a text file. I don't have any code handy that will save all as 1 text file, like outlook does when you select more than one message.
 
The easy stuff first: paste the rss url in the address bar of your browser.

http:// www. linkedin. com/rss/questions?cat=CAR_JOB (the spaces are mine - I don't want the forum to convert it to link) - returns this:

Okay, just went there and it took me to some Google site, and then I chose the first one. I'll figure it our somehow.

If iCloud control panel is installed and configured, it should sync, but it doesn't work for everyone and you can't set it as default. CodeTwo is working on an addin that will do outlook to iCloud or gmail direct sync. I don't know the ETA on that though.

Okay, yes, I just looked and it did sync with my iPhone. I just figured when it synced with my iPhone, I assumed that it would warn me of the coming events that day. I still have to "play around" with it.

On the calendar events, export your calendar and you'll see the full list of default fields.

Yes, I see them now, they only thing I don't know is what is a viable entry for each field. I know that some fields only accept ON/OFF, YES/NO, etc.

The macro you posted runs on all email as it arrives. The one linked to above does only the selected message (1 message). The code at SaveSelectedMailAsTxtFile.txt

is a tweaked version of my code that saves each selected message as a text file. I don't have any code handy that will save all as 1 text file, like outlook does when you select more than one message.

Okay, my problem is how do you run the macro when reading the e-mail or when you select the e-mail, how do you start the macro? I know this is dumb, but I'm willing to bet you that it's sitting right under my nose! :)
 
Okay, yes, I just looked and it did sync with my iPhone. I just figured when it synced with my iPhone, I assumed that it would warn me of the coming events that day. I still have to "play around" with it.

Outlook or the phone? You have 2013, so the only way to see upcoming events in Outlook is in Outlook today or using the Calendar peek.

Yes, I see them now, they only thing I don't know is what is a viable entry for each field. I know that some fields only accept ON/OFF, YES/NO, etc.

I think i have a list somewhere and msdn should have one too - or create a new calendar folder, add appointments and fill in the fields you are interested in. You'll need at least 5 to cover all the Free/Busy options. Export to Excel and check the fields.

In the yes/no fields you can use true and false. It should work to use 1 and 0 too. RemindBeforeHand time is in minutes.
 
Okay, my problem is how do you run the macro when reading the e-mail or when you select the e-mail, how do you start the macro? I know this is dumb, but I'm willing to bet you that it's sitting right under my nose!
oops, forgot this one.

You can create a button for it on the ribbon. Add the macro to the editor, go to file, Options, customize. Select Macros from the 'look here' dropdown, Add the macro to a new group.
 
oops, forgot this one.

You can create a button for it on the ribbon. Add the macro to the editor, go to file, Options, customize. Select Macros from the 'look here' dropdown, Add the macro to a new group.

Okay, I think that you just flew over my head. :) I found this at How To-Outlook:

In Outlook 2010, things have been made a lot easier as it allows you to manually customize the Ribbon as well.
1.Open the item window where you’d like to add the macro button to.

2.Select the tab where you’d like to add the macro button to.

3.Click the File button next to the Home tab and choose Options. Here, select the section “Customize Ribbon”.

or

Right click any tab and choose “Customize the Ribbon”.

You’ll find the current tab already highlighted and selected.

4.Create a New Group or even a New Tab to place your custom button in. You cannot add your button to an existing group.

You can use the Rename… button to give your group and/or tab a nice name.

5.From the dropdown list “Choose commands from:” select: Macros.

The list below will now show you all your macros.

6.Select the macro that you wish to create a button for and press the Add >> button.

7.To modify the name and icon press the Modify… button.
- Unlike a toolbar button, you cannot assign your ALT+key combination via letters.
When you close the Editor Options dialog and press and release the ALT button on your keyboard, you’ll a letter above the tabs. Type the letters above your tab and then you’ll see letters above the the commands on the commands. Type the letter above your macro to activate your macro.
- Unlike a toolbar button, you cannot paste your own icon or freely edit it. However, the icon list is longer and the icons are of a higher quality when compared to previous versions of Outlook.

8.Close the Editor Options dialog to return to your item window and use your button.

I got as far as putting the button on, but the rest, I couldn't figure out. When I choose Macros on the left, there are none. See Below:

6-5-2013 11-00-27 PM-4.jpg

Can you tell me if I'm going in the right direction? I didn't realize all this has to be done before you create a macro. I still don't know where I'm suppose to put the text (the actual macro), in some sort of editor? How do I access the Macro editor? I have to admit doing a Macro is Excel isn't this complicated, the think. :eek:

Thank You.
 
No, you create the macro first then the button.
 
No, you create the macro first then the button.

Okay, that's where the problem comes from. I must have spent three hours researching on how to create a button for a macro, I found allot, followed the instructions to the best of my ability, and became frustrated not finding out how to create a button for a macro!

During my research on how to create a button, I was reading on how to setup Outlook 2013 as a newsgroup reader, and you also had to first create a button and mentioned something about the GO menu, and there should be NEWS somewhere. It totally confused me! :(

I was also reading that you can use Outlook express to get news, but they said that you can integrate into Outlook 2013 seamlessly. Is this possible? BTW, I haven't been able to find anything for Outlook 2013 to read Usenet newsgroups.

Can you tell me how to create a button for a macro and explain what this "GO" menu or what ever it is to me?

Thank You.
 
Outlook Express won't work with Outlook 2013. :) They removed all news capability from Outlook 2010, so its gone from 2013 also.

I meant to record a how to video the other day and got side tracked with work. :( You won't set a button for your macro - its application startup / itemadd macro and runs automatically. My macro can be added as button.

This is a quickie video showing how to do it.

http://www.screencast.com/t/lNXCx3BS
 
Thank you Diane for making the video. I really appreciate it very much. That brought up another question, and that is, do I need to have Visual Basic installed to add a macro, which is basically a test file? Plus, under Developer, it's all ghosted out. See below.

1-Macros.jpg

I'm not not good at writing Visual Basic, but I understand the principles. I can look at the script and tell you what's going on, but as far as writing my own script, that's just out of my reach, right now!:eek:

Thank You.
 
The grayed out commands is normal.

You can get by without knowing how to code - there are a lot of macros online, slipstick.com and VBOffice.net both have working samples. JP (i don't have the address offhand - it comes up in a lot of outlook vba searches) has full code samples. and David Lee aka "Technilee" has a lot of usable code online, on his wordpress site and also as experts exchange. Outlookcode.com has samples but also a lot of code snippets that aren't complete.
 
The grayed out commands is normal.

You can get by without knowing how to code - there are a lot of macros online, slipstick.com and VBOffice.net both have working samples. JP (i don't have the address offhand - it comes up in a lot of outlook vba searches) has full code samples. and David Lee aka "Technilee" has a lot of usable code online, on his wordpress site and also as experts exchange. Outlookcode.com has samples but also a lot of code snippets that aren't complete.

Yes, I understand that I cannot CREATE a Macro without knowing how to code, but I understand the working of most codes, including C++, Java, and others. What I am saying is that I found some macros (see previous post) on line, I just have to know how to incorporate them into a Macro so I can run them in Outlook 2013. That's why I came here, because I did find a macro on Slipstick.com. My question was, "Do I need to have Visual Basic installed to run a macro?", if so, I can install it, but if I don't need it, I won't, because I don't like to have a ton of things installed on my Windows 7 Ult SP1 [32-bit] because I already have allot installed, and I also uninstalled some that I rarely use very often.

Thank you for being patient with me. :)

David
 
You need to have Outlook VBA enabled - it should be installed by default with office and is normally enabled. You do not need Visual Studio or whatever they call it now to run macros in outlook. You would need it if you are going to create a com addin.

In Outlook, go to File, Options, Addins and verify VBA is enabled.
 
You need to have Outlook VBA enabled - it should be installed by default with office and is normally enabled. You do not need Visual Studio or whatever they call it now to run macros in outlook. You would need it if you are going to create a com addin.

In Outlook, go to File, Options, Addins and verify VBA is enabled.

Okay, I believe that is Enabled, but it is Inactive.
1-Add-Ins-6-16-2013 6-12-36 PM.jpg

Thank You. :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
F Running Scripts in Outlook 2021 Using Outlook 0
D Stopping "do you want to continue running scripts on this page" warnings Using Outlook 4
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
N contact notepad 'style' getting changed after clicking and running Activities Using Outlook 2
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
S Problem running Command button code Outlook VBA and Custom Forms 2
B Automation error running VB macro code Outlook VBA and Custom Forms 8
Diane Poremsky OUTLOOK.EXE continues running after you exit Outlook Using Outlook 0
Diane Poremsky Running Outlook Macros on a Schedule Using Outlook 0
B ActiveExplorer return NULL on new Window user login and running Outlook first time Using Outlook 1
JorgeDario Template oft that contains VBScript Is not running Using Outlook 1
M Mark Complete keyboard shortcut... on a mac running Windows Bootcamp Using Outlook 0
N Outlook 2007 To-Do-List status keeps running Using Outlook 2
S The attempted operation failed ... 2nd time running code Outlook VBA and Custom Forms 3
G email returns after running macro to move emails Outlook VBA and Custom Forms 1
P Outlook Macro keeps running for the same messagage Using Outlook 2
N Running multiple macros upon sending Outlook VBA and Custom Forms 6
M Accessing BCM with Excel / Running Reports BCM (Business Contact Manager) 1
G Error when running scanpst.exe Using Outlook 1
M Running macros in tasks sent out as meeting requests in invitees machine Using Outlook 4
N Rules stop running automatically Using Outlook 10
D VBA code running on Server? Shared mailbox email routing Using Outlook 3
T WAB editing: To help prevent malicious code from running.......... Using Outlook 18
M Outlook.exe 1.2Gb memory usage if running certain BCM reports BCM (Business Contact Manager) 8
M Why rules stop running automatically? Using Outlook 1
V Trouble Running Outlook 2007 and 2010 Using Outlook 4
S CSCANPST To Automate Running SCANPST.EXE Using Outlook 1
L remove a hotmail account from Outlook 2007 running on Vista home premium Using Outlook.com accounts in Outlook 1
S Outlook 2007 Running on Windows 7 hangs on send Using Outlook 7
A running code after the new inspector is visible Outlook VBA and Custom Forms 1
M Running Outlook as Scheduled task Outlook VBA and Custom Forms 1
S ActiveExplorer return NULL on new Window user login and running Outlook first time Outlook VBA and Custom Forms 19
E Word macro running from OL VBA throwing error on Word SaveAs?? Outlook VBA and Custom Forms 8
A Running Code in Side by side calendar view Outlook VBA and Custom Forms 2
G Re:Running a Macro when email arrives Outlook VBA and Custom Forms 1
D Running a Program from Custom Action Rule Outlook VBA and Custom Forms 1
O Scheduled Task Fails running Code to send Outlook Mail from Excel. Outlook VBA and Custom Forms 9
B Phantom VBA Running Outlook VBA and Custom Forms 1
G To Prevent Malicious Code from running, one or more objects in thi BCM (Business Contact Manager) 2
M If loop not running Outlook VBA and Custom Forms 1
D Troubleshooting rule/script not running Outlook VBA and Custom Forms 5
P How to use a form from a rule running on the inbox Outlook VBA and Custom Forms 1
S To help prevent malicious code from running, one or more objects in this form were not loaded. For m Outlook VBA and Custom Forms 1
Q Running the Database from a Server BCM (Business Contact Manager) 7
N Running Code before Access 2007 closes down Outlook VBA and Custom Forms 1
S Outlook rules not running automatically Using Outlook 11
D Too many scripts? Outlook VBA and Custom Forms 1
B run scripts Using Outlook 1
T 2 mostly identical scripts, only one works Using Outlook 16

Similar threads

Back
Top