lukeshuttlewood
Board Regular
- Joined
- Jul 27, 2004
- Messages
- 90
Hi,
Some time a ago I found and used some code that grabs the users email address from outlook. This all worked smoothly until office was upgraded to security conscious 2003.
When I run the following code in Office Excel 2003:
I get this message prompt:
I had a snoop at the thread below which seems to address a very similar problem:
http://www.mrexcel.com/board2/viewtopic.php?t=167779&highlight=cdo
Apparently its the 'SendKeys "%{s}", True' that has the desired effect but this as it stands doesnt work for the code im using!
Does anyone know how I can adapt this to suit my needs?
Many thanks
Luke[/code]
Some time a ago I found and used some code that grabs the users email address from outlook. This all worked smoothly until office was upgraded to security conscious 2003.
When I run the following code in Office Excel 2003:
Code:
On Error GoTo Error1
Dim myOlApp As Object
Dim myNameSpace As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Emailaddress = myNameSpace.CurrentUser.Name
GoTo Success
Error1:
Emailaddress = "Could not get username"
Success:
I get this message prompt:
A programme is trying to access email addresses you have stored in outlook. Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No".
YES / NO
I had a snoop at the thread below which seems to address a very similar problem:
http://www.mrexcel.com/board2/viewtopic.php?t=167779&highlight=cdo
Apparently its the 'SendKeys "%{s}", True' that has the desired effect but this as it stands doesnt work for the code im using!
Does anyone know how I can adapt this to suit my needs?
Many thanks
Luke[/code]