Sign in to follow this  

VBS - UserProfile Path and File

Recommended Posts

brink668    14

Set olApp = CreateObject("Outlook.Application")

Set olMsg = olApp.CreateItem(0)

Set objShell=CreateObject("Wscript.Shell")

With olMsg

'.To = ""

'.CC = ""

'.BCC = ""

.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"


End With

Share this post

Link to post
Share on other sites
jake1eye    6

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


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  

  • Recently Browsing   0 members

    No registered users viewing this page.