How do I add a picture in a custom Contact form?

W

Wladdy

I am making a custom contact form.
How do I attach a different picture for each contact, like in the
default Contact form?
Under what field will the the picture be embedded or linked to?

Thanks for helping me out.

W.
 
S

Sue Mosher [MVP-Outlook]

See my response to your post in another group.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Hi,

I've been through this two months ago.
There are several ways to go around the fact that you can not use the native
MS Control on the Contact form, but if you want to be clean and avoid one
offed forms there's only one way : you need to load a picture file into a
picture control. And it needs be a file. Moreover, the user's form must have
read AND write rights on the share where the pictures are stored, AND on the
pictures themselves.
This last point was the particular problem I discovered in the process : I
had to let users the capability to alter the pictures...

This problem I solved simply by emulating what is said to be the way the MS
Control actually work : I attach the picture to each contact item : same
method as to attach a file to mail item.
Then each time the form is opened, the attached picture will be saved to the
user's drive and loaded into a picture control with a vbs script on the form
(the vbs sript is from Sue).
This way the users have no rights to modify the pics : be it on a share, or
in the public folder, and the load method is happy with having all the rights
on the picture's copy.

Methods used - Most of it borrowed from Sue's book

** Saving attachment in VBS
FileName = "C:\Documents and Settings\" & strUser & "\" &
Item.Attachments(1).FileName
Item.Attachments(1).SaveAsFile FileName

** Be sure the saved picture is not read only
If FileName <>"" then
Const READ_ONLY = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(FileName)
If objFile.Attributes AND READ_ONLY Then objFile.Attributes =
objFile.Attributes XOR READ_ONLY
End If

** Loading the picture
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("Général")
Set imgPicture = objPage.Controls("Image4")
imgPicture.Picture = LoadPicture(FileName)

** Closing the item inspector properly
Function Item_Close()
' Interception de l'évènement de fermeture
Item_Close = False

If Item.Attachments.count > 0 then
strUser = WSHUserName()
FileName = "C:\Documents and Settings\" & strUser & "\" &
Item.Attachments(1).FileName
End If
If FileName <> "" Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile FileName
End If
Item.Close 1
End Function

Regards,
Philippe


"Wladdy" a écrit :
 

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