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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
Couldn't you use the Body (or HTMLBody?) property do, well, set the body of the appointment?
 
Upvote 0

Dozo2000

New Member
Joined
Dec 8, 2016
Messages
24
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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
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

Dozo2000

New Member
Joined
Dec 8, 2016
Messages
24
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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
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

Dozo2000

New Member
Joined
Dec 8, 2016
Messages
24
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,191,116
Messages
5,984,737
Members
439,906
Latest member
Sekiro1899

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
Top