Execute in background

Dozo2000

New Member
Joined
Dec 8, 2016
Messages
24
It it possible to execute (run) this part of my macro in the background, so the Outlook Appointment window doesn't show?

When I delete the " olAppt.Display ", it doesnt add the Selection to the body of the appointment anymore.

Code:
Set olAppt = Outlook.Application.CreateItem(olAppointmentItem)
    olAppt.Display
    
    Set Selection = olAppt.GetInspector.WordEditor.Windows(1).Selection
          
    Selection.TypeText ("Call: " & Blad1.Cells(r, 15).Value & " about (" & Blad1.Cells(r, 3).Value & ").")
    Selection.TypeText (vbNewLine & vbNewLine)
    Selection.TypeText ("and: " & Blad1.Cells(r, 23).Value & ".")
    Selection.TypeText (vbNewLine & vbNewLine)
    Selection.TypeText (Blad1.Cells(r, 11).Value & " - " & Blad1.Cells(r, 22).Value)
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Couldn't you use the Body (or HTMLBody?) property do, well, set the body of the appointment?
 
Upvote 0
No. I am using a hyperlink from the sheet that is written to the body.
Body doesn't work.
and HTMLbody didn't work either.
 
Upvote 0
This doesn't do anything?
Code:
    Set olAppt = Outlook.Application.CreateItem(olAppointmentItem)
    olAppt.Body = "This is the body of the appointment"
    olAppt.Display

PS I can't really test that without seeing the rest of your code but in theory it should work.:)
 
Upvote 0
That works.
But not if i want to add a hyperlink from my sheet to the body of the outlook appointment.

My macro works, but the appointment-screen are showing up shortly and i wonder if that can be avoided.
 
Upvote 0
If you want to add a hyperlink to the body of the appointment you need to use HTMLBody and use the appropriate HTML tags/code.
 
Upvote 0
I thought (read somwhere) that it only works in email posts and not in appointment body.
That's why I use the Word.selection.

Do you have an example how I get .htmlbody to work?
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top