Sign in to follow this  
Followers 0
brink668

VBS - UserProfile Path and File

2 posts in this topic

Set olApp = CreateObject("Outlook.Application")

Set olMsg = olApp.CreateItem(0)

Set objShell=CreateObject("Wscript.Shell")

With olMsg

'.To = "test@test.com"

'.CC = "cc@testing.com"

'.BCC = "bcc@testing.com"

.Subject = "While You Were Out: "

.HTMLBody = "<html><p></p>" & _

"<img src='cid:wywo_notification.jpg'>"

I am having trouble with this part. I cant get the file and the userprofile piece to work correctly.

.Attachments.Add strHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\wywo_notification.jpg"

The below direct path works but not when adding the userprofile variable

'.Attachments.Add "C:\users\doej\wywo_notification.jpg"

.Display

End With

Share this post


Link to post
Share on other sites

1:\ Use code brackets for code, it makes it easier to read


Test Code Here

2:\ Have you thought of making a variable for the pathway Example

Dim Act :Set Act = CreateObject("Wscript.Shell")


Dim Dtop :Dtop = Act.ExpandEnvironmentStrings( _

  "%UserProfile%" & "\Desktop")

3:\ How are you coding the path in the script?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.