inserting user email address

stephenscott

New Member
Joined
Mar 19, 2008
Messages
29
I have a excel template and am looking to insert the individual users email into a cell automatically.

Is there a user profile within windows or excel where I can capture the specific address or

Do I need to setup a sheet with all user names and email addresses?, if so how do I connect that list with the specific user to automatically populate the field?

Any advice would be much appreciated.
 
This is exactly what I have but I am getting Runtime error 438 Object doesn't
support this property or method
Username is Stephen and I have a stephen.jpeg file in C:


Private Sub Workbook_Open()
Dim asd As Variant
Dim dsa As String
Dim filepath As String
filepath = "C:\"
asd = "@hotmail.com"
dsa = (Environ$("Username"))
ThisWorkbook.Sheets("Sheet1").Range("H51").Value = _
dsa & asd
ThisWorkbook.Sheets("Sheet1").Range("G54").Pictures.Insert _
filepath & dsa & ".jpeg" 'if this doesnt work remove brackets
End Sub


my apologies, didnt test the code.

use the below instead

ThisWorkbook.Sheets("Sheet1").Range("G54").Select
ActiveSheet.Pictures.Insert (filepath & dsa & ".jpg")

but personally inserting images inst a good go, they insert over cells not so much into. can text do the trick? or has to be image?
 
Last edited:
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
This seems to do the trick on my test template. Thanks !:)

I am in need of a "signature file" and beleive image is my only option will test further.

regarding the email component , would I be able to add the mailto: within the macro ie mailto:stephen@hotmail.com in order to make it a hyperlink to open the mail client ? or can I jest set the cel format ?

Thanks for all your help
 
Upvote 0
Just tried the macro on a excel template and it stoped at the following line below

Private Sub Workbook_Open()
Dim asd As Variant
Dim dsa As String
Dim filepath As String
filepath = "C:\My Documents"
asd = "@hotmail.com"
dsa = (Environ$("Username"))
ThisWorkbook.Sheets("Sheet1").Range("H51").Value = _
dsa & asd
ThisWorkbook.Sheets("Sheet1").Range("L51").Select
ActiveSheet.Pictures.Insert (filepath & dsa & ".jpg")

End Sub
 
Upvote 0
The filepath needs to end with a \
Eg:

Filepath = "C:\My Documents\"

Otherwise you are not calling the folder and the error you are getting would be something like file doesn't exist.

Cheers
 
Upvote 0
Unfortunately I am getting a New error

Runtime error '1004':
Insert method of pictures class failed

It is hanging on the line shown in Red

Private Sub Workbook_Open()
Dim asd As Variant
Dim dsa As String
Dim filepath As String
filepath = "C:\My Documents\"
asd = "@hotmail.com"
dsa = (Environ$("Username"))
ThisWorkbook.Sheets("Sheet1").Range("H51").Value = _
dsa & asd
ThisWorkbook.Sheets("Sheet1").Range("L51").Select
ActiveSheet.Pictures.Insert (filepath & dsa & ".jpg")
End Sub
 
Upvote 0
I would double check the spelling of the file and location. Ensuring the username is the name of file.

Also is it a jpg ? Maybe also try in the code .jpeg I stead
 
Upvote 0
I think its the location. each user has there own area for my documents. on windows 7 would be like

C:\Users\nickolas.benson\Documents\

xp from memory is

C:\Documents and Settings\nickolas.benson\My Documents\

please check if this is so
 
Upvote 0
I think its the location. each user has there own area for my documents. on windows 7 would be like

C:\Users\nickolas.benson\Documents\

xp from memory is

C:\Documents and Settings\nickolas.benson\My Documents\

please check if this is so


how did you go?
 
Upvote 0

Forum statistics

Threads
1,224,620
Messages
6,179,928
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top