Hi All, I'm new here but have already found several solutions to my existing problems. Thanks!
One problem remains vexing, though. I am using an HTA to create an Outlook MeetingItem (appointment) from a "calendar-like" formatted text and attachments copied to the Clipboard, but I have not been able to figure out how to copy the Clipboard text to the Body in the Meeting as formatted text. Further, the attachments don't come over (but do when I do this manually by pasting the Clipboard to the body as formatted text).
Here is the sub at issue:
Any suggestions, clues? TIA
PGilm
One problem remains vexing, though. I am using an HTA to create an Outlook MeetingItem (appointment) from a "calendar-like" formatted text and attachments copied to the Clipboard, but I have not been able to figure out how to copy the Clipboard text to the Body in the Meeting as formatted text. Further, the attachments don't come over (but do when I do this manually by pasting the Clipboard to the body as formatted text).
Here is the sub at issue:
Code:
Sub outl(x)
Dim olApp : Set olApp = CreateObject("Outlook.Application") ' this gets/creates the outlook instance
Dim cont : cont = document.parentwindow.clipboardData.GetData("text") ' this pulls in the clipboard
if IsNull(instr(cont,"Subject: ")) then msgbox "You need to copy a mtg text first" : exit sub ' check to make sure I some clipboard text
if instr(cont,"Subject: ") < 1 then msgbox "You need to copy a mtg text first" : exit sub ' now check to see if clipboard contains "calendar-like" text
Dim olCal : Set olCal = olApp.CreateItem(1) ' 1 is for creating an olAppointmentItem
olCal.MeetingStatus = 1 ' 1 is to make it an olMeeting
olCal.Recipients.Add("myrecipient@blahblah.com") ' populate recipients
olCal.Subject = "bn " & mid(cont, instr(cont,"Subject: ")+9, instr(cont,"When: ")-instr(cont,"Subject: ")-11) ' populate subject
olCal.Location = mid(cont, instr(cont,"Where: ")+7) ' populate location
olCal.Body = cont ' This gives me unformatted text and no attachments. I want it formatted (but .HTMLBody is not supported by this item type).
Dim conts ' a bunch of fancy text manipulations to find start and end times (there may be a better way, but it works)
conts = mid(cont, instr(cont,"When: ")+6, instr(mid(cont, instr(cont,"When: ")+6),"-")-1)
conts = mid(conts, instr(conts, "day,")+5)
olCal.Start = cdate(conts) ' after all that, here is the start date and time
conts = mid(cont, instr(cont,"When: ")+6, instr(mid(cont, instr(cont,"When: ")+6),"GMT")-2)
conts = mid(conts, instr(conts, "day,")+5)
conts = left(conts, instr(conts, ", ")+6) & mid(conts, instr(conts, "-")+1)
olCal.End = cdate(conts) ' and here is the end date and time
olCal.Display ' now bring up the MeetingRequest item
Set cont = Nothing
Set conts = Nothing
Set olApp = Nothing
End Sub
Any suggestions, clues? TIA
PGilm