Solved Issue with Outlook Object Code (1 Viewer)

Eureka99

New member
Local time
Today, 20:13
Joined
Jun 29, 2020
Messages
26
Hi All,

I have some code for creating a meeting within MS outlook that appropriated (I don't know much about creating meetings using VBA).

The issue is it seems to cycle through the code and it gives me a Runtime 440 error saying parts are not supported.

The two that it has flagged so far are the .Body and .location instructions. can anyone with more experience then me error check the code please and see whats wrong?

Code:
Strinvitees = User1 & "; " & HR & holonl & WPT & MRID


Dim outApp As Object
    Dim outMail As Object
    Const olAppointmentItem = 1
    Set outApp = CreateObject("Outlook.Application")
    Set outMail = outApp.CreateItem(olAppointmentItem)
      
    
                
     With outMail
        .To = Strinvitees
        .Subject = Me.MSubject
        .Body = Me.Mdescription
        .Location = MRoom
        .MeetingStatus = olMeeting
        .Start = Me.MDate + Me.MStartTime
        .End = Me.MDate + Me.MStopTime
        .ReminderMinutesBeforeStart = 30
        .ReminderSet = True
        .Display
         End With
        
        
     For Each objOutlookRecip In outMail.Recipients
                'Debug.Print objOutlookRecip.Name
                objOutlookRecip.Resolve
            Next
  
    Set outMail = Nothing
    Set outApp = Nothing
 

Minty

AWF VIP
Local time
Today, 20:13
Joined
Jul 26, 2013
Messages
10,371
Put all the items you need into variables e.g.

Code:
Dim strLocation as String
Dim strBody   as String

strLocation = MRoom
strBody  = Me.MDescription

Then use the local variables in the Outlook code.
I have seen instances where the outlook object doesn't like the direct form references.

By the way where is MRoom declared?
 

Eureka99

New member
Local time
Today, 20:13
Joined
Jun 29, 2020
Messages
26
Worked perfectly. MRoom is a field on the form. For some reason it worked better without the Me.MRoom.

It populates the correct part on the meeting request.
 

Users who are viewing this thread

Top Bottom