Discussion:
Printing of Bcc
(too old to reply)
Kerstin
2009-11-20 12:47:18 UTC
Permalink
Hi,

is it possible to change an opened SendItem mail?
I want to add the Bcc field at page 2 for printing the mail with that field.
I am able to do this in a manual way.
Now I want to do these steps via VBA.

Has anybody an idea?

Thank you very much
Kerstin

Sub BccDrucken()

'das Script blendet für die aktuelle Mail die Seite 2 ein

'und fügt das Bcc-Feld ein und die Option 'Drucken' wird aktiviert



Dim objApp As Application

Dim objItem As MailItem

Dim objInsp As Inspector



Set objApp = CreateObject("Outlook.Application")

Set objItem = objApp.ActiveInspector.CurrentItem

Set objInsp = objItem.GetInspector



If objItem.Class = olMail And objItem.Sent = True Then

With objInsp

.ShowFormPage "S.2"

.ModifiedFormPages("S.2").Controls("Bcc").Add <-- this is
not allowed

End With



End If





Set objApp = Nothing

Set objItem = Nothing

Set objInsp = Nothing



End Sub
Michael Bauer [MVP - Outlook]
2009-11-20 18:41:32 UTC
Permalink
This is not my area. However, if it works at all, you certainly need to call

.ModifiedFormPages("S.2").Controls.Add "whatever"

You might use the object browser (f2), select the Controls object left hand,
and the Add function right hand, and see the parameter list at the bottom.
Maybe pressing f1 will give you more help on this.
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Kerstin
Hi,
is it possible to change an opened SendItem mail?
I want to add the Bcc field at page 2 for printing the mail with that field.
I am able to do this in a manual way.
Now I want to do these steps via VBA.
Has anybody an idea?
Thank you very much
Kerstin
Sub BccDrucken()
'das Script blendet f� aktuelle Mail die Seite 2 ein
'und f�s Bcc-Feld ein und die Option 'Drucken' wird aktiviert
Dim objApp As Application
Dim objItem As MailItem
Dim objInsp As Inspector
Set objApp = CreateObject("Outlook.Application")
Set objItem = objApp.ActiveInspector.CurrentItem
Set objInsp = objItem.GetInspector
If objItem.Class = olMail And objItem.Sent = True Then
With objInsp
.ShowFormPage "S.2"
.ModifiedFormPages("S.2").Controls("Bcc").Add <-- this is
not allowed
End With
End If
Set objApp = Nothing
Set objItem = Nothing
Set objInsp = Nothing
End Sub
Kerstin Schiebel
2009-11-23 15:55:18 UTC
Permalink
Thank you.
But I can not add a control to the form page in any way.
I always get run time error 91.
Now I have no idea - I will stop my work :-(

Bye
Kerstin
Post by Michael Bauer [MVP - Outlook]
This is not my area. However, if it works at all, you certainly need to call
.ModifiedFormPages("S.2").Controls.Add "whatever"
Michael Bauer [MVP - Outlook]
2009-11-23 16:54:58 UTC
Permalink
That error means one of the objects you're trying to access is Nothing. To
find out which one it is, you just need to use a variable for each. I.e.,
instead of calling this:

.ModifiedFormPages("S.2").Controls.Add "whatever"

do it this way:

Dim obj as Object
Set obj=.ModifiedFormPages("S.2")
set obj=obj.Controls
obj.Add "whatever"

In this example, certainly the first Set statement fails, which means
there's no page named "s.2"
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Kerstin Schiebel
Thank you.
But I can not add a control to the form page in any way.
I always get run time error 91.
Now I have no idea - I will stop my work :-(
Bye
Kerstin
Post by Michael Bauer [MVP - Outlook]
This is not my area. However, if it works at all, you certainly need to call
.ModifiedFormPages("S.2").Controls.Add "whatever"
Kerstin Schiebel
2009-11-24 12:35:08 UTC
Permalink
Hi Michael,

thank you very much for your perseverance ;-)

"Michael Bauer [MVP - Outlook]" <***@mvps.org> schrieb im Newsbeitrag news:1wtkfb8fp83bk.7rcgf6zexy4w$***@40tude.net...
...
set obj=obj.Controls <--- this is the problem!
because at this time there is no control on the page???
On page 'S.2' is nothing, I want to add the first control.

Regards
Kerstin
Michael Bauer [MVP - Outlook]
2009-11-25 10:47:59 UTC
Permalink
Hi Kerstin,

no, the error only occurs if the object *before* the dot is nothing because
you never can call a method of Nothing.

In this case that means obj is Nothing, thus you can't call its Controls
property. (If Controls itself were Nothing that would be ok because it's ok
to set an object variable = Nothing.)

So, you need to figure out how the page you're looking for is named.
ModifiedFormPages("S.2") doesn't exist. Probably you can do that by
accessing each page by its index, then look for the name of the returned
object.
--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>
Post by Kerstin Schiebel
Hi Michael,
thank you very much for your perseverance ;-)
...
set obj=obj.Controls <--- this is the problem!
because at this time there is no control on the page???
On page 'S.2' is nothing, I want to add the first control.
Regards
Kerstin
Loading...