Link to home
Start Free TrialLog in
Avatar of piec2
piec2

asked on

Mail viewing and editing using a custom Post form

Here is what i need,

When i open a new mail message and i click Edit this Message, i want a post form that i have created to open. Is this in any way possible??? I found how to make Post in this Folder open my form but now i need my message to be in my custom form
Avatar of David Lee
David Lee
Flag of United States of America image

Greetings, piec2.

I don't believe it's possible to open a message created with one form and edit it using a different form.

Cheers!
Avatar of piec2
piec2

ASKER

Then would it be possible to modify an existing/original form to add an action?
I'm not sure, I've never tried, but I don't think you can edit the default forms.  You can create your own form that's a knock-off of one ofthe original forms though and add your own fields, code, etc.  What sort of action?
Avatar of piec2

ASKER

What i want it to do is when i open a received message, i want there to be a button that when it is clicked it will open my form but have copied the text from the original message into my form.
piec2,

That's quite a bit different from what I thought you were looking for.  That's doable with a bit of VBA.  Something like this:

Sub ReplyWithCustomForm()
    Dim olkMessage As Outlook.MailItem, _
        olkCustom As Outlook.MailItem, _
        olkFolder As Outlook.MAPIFolder
    Set olkMessage = Application.ActiveInspector.CurrentItem
    'Change the folder path to that of a folder with your custom form
    Set olkFolder = OpenMAPIFolder("\eeTesting\Jobs\Blah")
    'Change the form name to that of your form
    Set olkCustom = olkFolder.Items.Add("IPM.Note.MyCustomForm")
    'Copy the message properties from the original message to your message.  I'm only copying enough to give an example
    olkCustom.Subject = olkMessage.Subject
    olkCustom.BodyFormat = olkMessage.BodyFormat
    olkCustom.Body = olkMessage.Body
    olkCustom.HTMLBody = olkMessage.HTMLBody
    olkCustom.Display
End Sub

'Credit where credit is due.
'The code below is not mine.  I found it somewhere on the internet but do
'not remember where or who the author is.  The original author(s) deserves all
'the credit for these functions.
Function OpenMAPIFolder(szPath)
    Dim app, ns, flr, szDir, i
    Set flr = Nothing
    Set app = CreateObject("Outlook.Application")
    If Left(szPath, Len("\")) = "\" Then
        szPath = Mid(szPath, Len("\") + 1)
    Else
        Set flr = app.ActiveExplorer.CurrentFolder
    End If
    While szPath <> ""
        i = InStr(szPath, "\")
        If i Then
            szDir = Left(szPath, i - 1)
            szPath = Mid(szPath, i + Len("\"))
        Else
            szDir = szPath
            szPath = ""
        End If
        If IsNothing(flr) Then
            Set ns = app.GetNamespace("MAPI")
            Set flr = ns.Folders(szDir)
        Else
            Set flr = flr.Folders(szDir)
        End If
    Wend
    Set OpenMAPIFolder = flr
End Function

Function IsNothing(Obj)
  If TypeName(Obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
Avatar of piec2

ASKER

I understand the code but how do i add a button to my received message page.
Adding a button to the received message page on your form won't help.  It'd be better to add a toolbar button that you can click.  I say that for two reasons.  First, adding a button to your form won't help with received items.  They use a different form and you can't control them.  Second, if you put the button your form, then you'd have to open a recieved message, then open your form, then click the button to transfer the contents of the received message to your form.  It's simpler to click a button on the toolbar and have the last two parts of that done automatically.

Do you need instructions on adding a toolbar button?
Avatar of piec2

ASKER

no i know how to add a toolbar button but im not getting how that would help.
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of piec2

ASKER

Ok i understand now, but now my problem is ive searched everywhere to enable macros and i cannot find it, How do i do that? also, i cannot find how to make my button use my macro, i need to assign a hyperlink right? but how do i find where my macro was saved? ive looked everywhere...

Help
Avatar of piec2

ASKER

Nevermind I found it... THANK YOU SO MUCH
You're welcome.  Sorry I couldn't back to you earlier.