|
-
Jul 17th, 2009, 06:39 PM
#1
Thread Starter
Junior Member
[Excel -> Outlook]
Hello,
I have a macro written in VB in Excel, which reads emails from Outlook. I would like to automatize this process, but everytime, when Excel wants to access the outlook, I have to give permition to do that, see http://apophis.wz.cz/permition.PNG (It's in czech, but you will see the point). Is there any way to give this permition for ever? Or for long time, such as 10 hours? (I can choose max. 10 minutes).
Thanks for every idea.
Jakub Suchy
Last edited by gaspaccho; Jul 19th, 2009 at 03:26 PM.
Reason: I solved the previous problem
-
Jul 19th, 2009, 03:38 PM
#2
Lively Member
Re: [Excel -> Outlook]
The security measures of Outlook are very annoying but most of them are for Office 2003 their to stay. In 2007 there are new possibilities.
Can you tell us which part of your code fires this window?
-
Jul 19th, 2009, 03:55 PM
#3
Addicted Member
Re: [Excel -> Outlook]
You could modify your VBA code to use Outlook Redemption objects, which bypass the security prompts.
-
Jul 19th, 2009, 04:36 PM
#4
Thread Starter
Junior Member
Re: [Excel -> Outlook]
darbid: I have MS Office 2003 and part of code, which fires this window is (suprisly) this:
SomeVariable = SubFolder.Items(i).Body
His Nibbs: I will take a look.
I've found maybe very useful article here: http://www.outlookcode.com/article.aspx?id=52 , but I'm little confused, because my english and skills aren't good enough and there are so many options ( I need access just for one specific .xls file and it's on in my work computer, so I can't install any other program...
Thanks...
-
Jul 20th, 2009, 01:35 AM
#5
Lively Member
Re: [Excel -> Outlook]
Yes that reference you sent is to a good site where you will get all the answers you want about Outlook.
Are you sure that your code really fires the security window? In my experience the "body" of something should not.
So could you please post all of your code starting with how you get the Outlook application "get object".
-
Jul 20th, 2009, 12:37 PM
#6
Re: [Excel -> Outlook]
The Body property will indeed fire the security prompt as its a new secured property in Outlook 2003 and newer.
See my FAQ on it for more - http://www.vbforums.com/showthread.php?t=402086
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 28th, 2009, 06:39 PM
#7
Thread Starter
Junior Member
Re: [Excel -> Outlook]
Hello again,
I used Redemption (thanks for your help) and it works fine (I can read MailItem.Body,...) but I need to access my 2nd shared account in Outlook so I wrote something like this:
Code:
Set objRecipient = ns.CreateRecipient("My second account")
With objRecipient
.Resolve
If .Resolved Then
Set Inbox = ns.GetSharedDefaultFolder(objRecipient, olFolderInbox)
End If
End With
Now the line ".Resolve" fires the security promt and I'm unable to rewrite it to "Redemption language". I've tried to surf their official site but with no success. Does anybody know what I have to write there? Or is there any other way to go to my 2nd account without ".Resolve"? Thanks for any thaughts,
gaspaccho
-
Jul 31st, 2009, 06:02 PM
#8
Thread Starter
Junior Member
-
Aug 3rd, 2009, 04:12 AM
#9
Lively Member
Re: [Excel -> Outlook]
Sorry I have not used Redemption and cannot help you with a specific answer.
I also wanted to qualify my way of getting around the security measures OR how I avoid it. I had no idea what i was doing and it is by chance that I avoided it. This shows in my initial answer to you which was corrected.
Like you I am using another program other than Outlook to read the emails. When I came up with this problem my first question was which email does the user want read?
I solved this by creating a small macro (Outlook add-in) which created a button in outlook. When clicked it accepted the currently selected email as the email which the user wants to do something with.
This outlook macro then sends (calls a function) the MailItem as an object to the other program (Excel or Access) and it is my experience that when you use this object eg MailItem.body in ( Excel or Access) I at least do not get the security measures. (Outlook 2003 SP3)
You do not actually state how you "get your email" with excel but maybe the same method would work for you with recepients. Please note I have not tested it.
-
Sep 1st, 2009, 06:14 AM
#10
Addicted Member
Re: [Excel -> Outlook]
How are you declaring the objRecipient variable?
The normal way using Outlook objects is:
Dim objRecipient As Outlook.Recipient
But using Redemption it should be:
Dim objRecipient As Redemption.SafeRecipient
and then, maybe, you won't get the security prompt on the .Resolve line.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|