bypassing save dialog box

P

philippe

Hi,

I've just implemented sue mosher's way of displaying a photograph on a
customized form... using code to load a jpg into a picture control...
.... now I realize that every time my user will close the contact form, he
will be prompted to save the item.

How can I bypass this dialog box ?
Is there anything like the Application.DisplayAlerts = false of Excel VBA ?
Or how could i use (if it is possible) a sendkeys in VBScript to tell No to
the dialog box ? (The dialog box is Yes No Cancel).

Thanks in advance,
and in case you've a better way to display a photograph in outlook 2003 i
also am interested.
 
K

Ken Slovak - [MVP - Outlook]

For Outlook 2003 I would use the AddPicture method since that version of
Outlook already has a picture control and doesn't even need to be a custom
form to show the picture. I'd venture that the method shown is used mostly
for previous versions of Outlook.

ContactItem.AddPicture("Path") will add a picture located at "Path" into the
built-in picture control in Outlook 2003's contact forms. RemovePicture is
the mirror to remove a picture image and ContactItem.HasPicture is a Boolean
property that tells you if a contact already has a picture.

Those methods and property were only added in Outlook 2003 though.

Also, if the item isn't saved in code (ContactItem.Save) the user will be
prompted to save since the item was modified after it was opened.
 
P

philippe

Thank you Ken.

I have to use a custom form, and thus can't use the picture control hence my
problem.
I do not save the item in the code for users on whose machines the code will
execute won't have writing permissions to the public folder.

I wonder if it is possible to use a picture control, load a pic in it, and
get it saved within the item (without one offing the form)... then I could
prepare all items in VBA on the public folder, and would not need any code to
execute on user's machines (which I prefer).

Obviously the AddPicture method only refers to THE picture control that one
can see on the contact form (as long as one does not modify the general tab).
As a matter of fact : I can't see in the method description any argument
dedicated to tell which picture control to use as a destination.

Sue Mosher uses a load method on a control of what seems to be an undefined
type :
Function Item_Open()
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("General")
Set imgPicture = objPage.Controls("Image4")
If Item.BillingInformation <> "" Then
imgPicture.Picture = _
LoadPicture(Item.CustomFieldPictureAddress)
End If
End Function

I'm thus have the feeling that it's not possible to have a photograph saved
into an item and displayed in a picture control.
Thus my original questions :
- to hide the saving prompt to users or
- find a way to control to save things in a notes control - I don't
understand how outlook stores pictures or the content of the notes.

Thanks to you or anyone for reading up to this point.
Regards,
Philippe
 
K

Ken Slovak - [MVP - Outlook]

Sue's code uses an Image control. You have to use an image control or
something like that or the built-in control for Outlook 2003. If you modify
an item the user will get prompted, no matter what you do if you don't save
the item. If you save something "within the item" you are saving the item.

Something has to give, you can't have everything you want.
 
P

philippe

Hi,
I well know I can't get everything I want. Thanks for your interest.

I've just tried this :
Executed Sue's code in VBA (outside of the form), and added a save item.
I run the code on the all folder.
When I open any item, i get the picture properly displayed, and since the
loading is not done at the item open, no request for saving.
Works just like I wished it would... except if I restart Outlook, then I
realised, that nothing was saved... it's like if what have been saved is a
property for a control in each contact for as long as this outlook session
last.

I'm not surprised I expected nothing would "actually" be saved into the item.
I'm more impressed by the fact that it "works" while the session last !
But it does not solve the issue : how to save a pic with an item without one
offing and while using a custom form ?
 
K

Ken Slovak - [MVP - Outlook]

I can't think of anything else.

If you add a control to your custom form after it's published that will
one-off the form. If you add the picture to the control and want it there
always you must save the item so the picture remains.
 

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