Email permission question...

G

gab1972

I have a spreadsheet with a macro that takes some information and puts
it in an email. It works fine for me, but when I give the spreadsheet
to someone else and they click the macro button, an error occurs
letting the user know that permission to outlook is not permitted. Is
this an 'owner' issue? I went into File > Properties and deleted
myself as the author. However, I do see that my name is still in as
the owner. If I am the owner and someone else uses the program and
tries to open email...does outlook automatically try to open the
'owners' outlook and that is why there is a permission error?

Any help would be appreciated.
 
R

ryguy7272

If the code works fine one one machine and errors on another machine, it is
probably an issue with a reference. Check this out:
http://www.cpearson.com/excel/References.htm

Alt + F11 > Tools References > Microsoft Object XX.X Object Library
for me, the XX.X = 10.0; yours may be different...depends which version of
Excel and Outlook you are on.

HTH,
Ryan---
 
G

gab1972

If the code works fine one one machine and errors on another machine, it is
probably an issue with a reference.  Check this out:http://www.cpearson..com/excel/References.htm

Alt + F11 > Tools References >  Microsoft Object XX.X Object Library
for me, the XX.X = 10.0; yours may be different...depends which versionof
Excel and Outlook you are on.

HTH,
Ryan---

Thanks for the fast reply Ryan. Everyone in my building has the same
version of Outlook. I had set the reference library already. Mine is
Microsoft Office 11.0 Object Library. We are using Office 2003. When
I passed on the spreadsheet to other users, I made them go in and
check to make sure they had the same library references as me. Still,
I get the permission error. That's why I was wondering if maybe
because the file properties have me listed as the owner if maybe
Outlook will only access email where I am logged in??? If this is the
case, can I VBA some coding to remove ownership? Or do all files have
to have an owner? Or can I VBA some code to assign an owner?
 
G

gab1972

Follow Ron's advice; use late binding.

Good luck,
Ryan---

I will be trying this. I changed my coding around like Ron
suggested. I'll let you know if this method worked better for my
users.

Thanks in advance
 
G

gab1972

Okay, so I followed Ron's advice and used his coding. However, I'm
still getting a permission error when someone else uses the
spreadsheet. I have a macro assigned to a button. It opens an email,
fills in the subject and body, adds some attachments, and then waits
for the user to input an email address. It works fine for me. I
created the spreadsheet and it is stored on a shared drive. However,
when another user logs into their computer and tries to use it, it
says that they do not have permission.
 
G

gab1972

Okay, so I followed Ron's advice and used his coding.  However, I'm
still getting a permission error when someone else uses the
spreadsheet.  I have a macro assigned to a button.  It opens an email,
fills in the subject and body, adds some attachments, and then waits
for the user to input an email address.  It works fine for me.  I
created the spreadsheet and it is stored on a shared drive.  However,
when another user logs into their computer and tries to use it, it
says that they do not have permission.

I fixed it. Come to find out, it wasn't anything with the coding.
The email that gets generated has attachments. Apparently one of my
attachments had a permissions setting that didn't let certain users
access it...hence the permissions error. We allowed access and the
coding works like a charm.

Thanks for everyone's help and hopefully this will be searched someday
and it will help someone out.

incidentally, here is the coding I used to generate an email, add
stuff to the body, include attachments, and then wait for the user to
enter an email address.

Option Explicit
Sub SendPermitPackage()
'
'Code to send a permit application package via email
'Prompts a new email with a canned subject and body including
attachments
'
Dim wkb As Workbook
Dim wks As Worksheet
Dim Rng As Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

'****************************************************************************
' For early binding
' Dim olMyApp As Outlook.Application
' Dim olMyEmail As Outlook.MailItem
'
' 'Set the macro to use the Outlook object library [USERS MUST
ACTIVATE
' 'THIS IN THE TOOLS > REFERENCES SECTION!]
' Set olMyApp = New Outlook.Application
' Set olMyEmail = olMyApp.CreateItem(olMailItem)

'****************************************************************************

'****************************************************************************
' For late binding
Dim olMyApp As Object
Dim olMyEmail As Object

Set olMyApp = CreateObject("Outlook.Application")
olMyApp.Session.Logon
Set olMyEmail = olMyApp.CreateItem(0)

'****************************************************************************

'Set the email parameters...i.e. body, subject, attachments...
olMyEmail.Subject = "Permit Application Package"
olMyEmail.Body = "*stuff you want in the body of the email*"

olMyEmail.Attachments.Add ("Z:\COMMON FILES\thing1.pdf")
olMyEmail.Attachments.Add ("Z:\COMMON FILES\thing2.pdf")
olMyEmail.Attachments.Add ("Z:\COMMON FILES\thing3.pdf")

'Display the email before sending it so that the user can input
the email
'address and any other text in the body.
olMyEmail.Display

'release the memory
Set olMyApp = Nothing
Set olMyEmail = Nothing

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top