You know, it's been a while since I diddled with this and
I remember getting that same error. It seems as if I just removed the
"As String" part after each DIM OBJ... and that did the trick.
Nikki
"Nikki Peterson" <SkippyLetterman@hotmail.com> wrote in message
news:eu4QGoGxJHA.5100@TK2MSFTNGP04.phx.gbl...
Here is what I have:
Dim objApp As Outlook.Application
Dim objItem As Object
Dim objSelection As Selection
Dim objAttendees As Outlook.Recipients
Dim objAttendeeReq As String
Dim objAttendeeOpt As String
Dim objOrganizer As String
Dim dtStart As Date
Dim dtEnd As Date
Dim dtCreate As Date
Dim strSubject As String
Dim strLocation As String
Dim strNotes As String
Dim strMeetStatus As String
Dim strUnderline As String ' Horizontal divider line
'added by Hugh
Dim x
Dim myMailItem
Dim strNoteBody
Dim iAccepted As Integer
Dim iDeclined As Integer
Dim iTentative As Integer
'to add office location
Dim strInvitee
'to gather office info from AD
Dim strLDAP
Dim strADOffice
Dim strADAddress
Dim strADCity
Dim strADState
Dim strADCountry
Dim strADPhone
'to check the invitee is a user
Dim myRecipient
'define hjs variables
iAccepted = 0
iDeclined = 0
iTentative = 0
Set objApp = CreateObject("Outlook.Application")
Set objItem = objApp.ActiveInspector.CurrentItem
Set objSelection = objApp.ActiveExplorer.Selection
Set objAttendees = objItem.Recipients
strUnderline = String(60, "_") ' use 60 underline characters
On Error GoTo EndClean:
' check for user problems with none or too many items open
Select Case objSelection.Count
Case 0
MsgBox "No appointment was opened. Please open the appointment to
print."
GoTo EndClean:
Case Is > 1
MsgBox "Too many items were selected. Just select one!!!"
GoTo EndClean:
End Select
' Is it an appointment
If objItem.Class <> 26 Then
MsgBox "This feature only works on items in your Calendar. Open an
Appointment and try again.", _
vbExclamation, _
"Not an Appointment"
GoTo EndClean:
End If
' Get the data
dtCreate = objItem.CreationTime
dtStart = objItem.Start
dtEnd = objItem.End
strSubject = objItem.Subject
strLocation = objItem.Location
strNotes = objItem.Body
objOrganizer = objItem.Organizer
objAttendeeReq = ""
objAttendeeOpt = ""
' Get The Attendee List
For x = 1 To objAttendees.Count
strMeetStatus = ""
Select Case objAttendees(x).MeetingResponseStatus
Case 0
If objAttendees(x).Name = objItem.Organizer Then
strMeetStatus = "Organizer"
Else
strMeetStatus = "No Response"
End If
Case 1
strMeetStatus = "Organizer"
Case 2
strMeetStatus = "Tentative"
iTentative = iTentative + 1
Case 3
strMeetStatus = "Accepted"
iAccepted = iAccepted + 1
Case 4
strMeetStatus = "Declined"
iDeclined = iDeclined + 1
End Select
strInvitee = objAttendees(x).Address
sbRetrieveADInfo strInvitee, strADOffice, strADAddress, strADCity,
strADState, strADCountry, strADPhone
'Debug.Print strADOffice & "~" & strADAddress & "~" & strADCity & "~" &
strADState & "~" & strADCountry & "~" & strADPhone
If strADAddress <> "" Then
strADAddress = "(" & strADAddress & ")"
Else
strADAddress = " "
End If
If strADPhone = "" Then
strADPhone = " "
End If
If objAttendees(x).Type = olRequired Then
objAttendeeReq = objAttendeeReq & objAttendees(x).AddressEntry & vbTab
& strADAddress & vbTab & strADPhone & vbTab & strMeetStatus & vbCr
Else
objAttendeeOpt = objAttendeeOpt & objAttendees(x).AddressEntry & vbTab
& strADAddress & vbTab & strADPhone & vbTab & strMeetStatus & vbCr
End If
strADOffice = ""
strADAddress = ""
strADCity = ""
strADState = ""
strADCountry = ""
strADPhone = ""
Next
''use Outlook instead
Set myMailItem = objApp.CreateItem(olMailItem)
myMailItem.Subject = "Attendee List for ~ " & strSubject & " ~ !Print Then
Discard!"
'begin building body of item
'html headers
strNoteBody = "<html><body><br>"
'html first table
strNoteBody = strNoteBody & "<Table>"
strNoteBody = strNoteBody & "<TR><TD><B>" & "Subject:" &
"</B></TD><TD><B>" & strSubject & "</TR>"
strNoteBody = strNoteBody & "<TR><TD>" & "Organizer:" & "</TD><TD>" &
objOrganizer & "</TR>"
strNoteBody = strNoteBody & "<TR><TD>" & "Location:" & "</TD><TD>" &
strLocation & "</TR>"
strNoteBody = strNoteBody & "<TR><TD>" & "Start:" & "</TD><TD>" &
dtStart & "</TR>"
strNoteBody = strNoteBody & "<TR><TD>" & "End:" & "</TD><TD>" & dtEnd &
"</TR>"
strNoteBody = strNoteBody & "<TR><TD>" & "Created:" & "</TD><TD>" &
dtCreate & "</TR>"
strNoteBody = strNoteBody & "</TABLE>"
'close first table
'second table counting responses
strNoteBody = strNoteBody & "<Table>"
strNoteBody = strNoteBody & "<TR><TD>" & _
"Accepted - " & iAccepted & "</TD><TD>" & _
"Declined - " & iDeclined & "</TD><TD>" & _
"Tentative - " & iTentative & "</TD><TD>"
strNoteBody = strNoteBody & "</TR>"
strNoteBody = strNoteBody & "</TABLE>"
'close table
'third table of required attendee responses details
strNoteBody = strNoteBody & "<P>" & "Required:" & "</P>"
'convert responses to a table
strNoteBody = strNoteBody & "<Table cellpadding=5 border=1>"
strNoteBody = strNoteBody & "<TR><TD>"
'Create headings for response table
strNoteBody = strNoteBody &
"Name</TD><TD>Location</TD><TD>Telephone</TD><TD>Response</TD><TR><TD>"
'remove trailing vbcrlf from object before creating html table
objAttendeeReq = Left(objAttendeeReq, Len(objAttendeeReq) - 1)
'Convert vbCrLf to html tags
objAttendeeReq = Replace(objAttendeeReq, vbCrLf, "<BR>")
'Convert vbCr to html tags
objAttendeeReq = Replace(objAttendeeReq, vbCr, "</TD><TR><TD>")
'convert vbTab to html tags
objAttendeeReq = Replace(objAttendeeReq, vbTab, "</TD><TD>")
strNoteBody = strNoteBody & objAttendeeReq
strNoteBody = strNoteBody & "</TR>"
strNoteBody = strNoteBody & "</TABLE>"
'close table
'4th table of Optional attendee responses details
strNoteBody = strNoteBody & "<P>" & "Optional:" & "</P>"
If objAttendeeOpt = "" Then
'do nothing
Else
'convert responses to a table
strNoteBody = strNoteBody & "<Table cellpadding=5 border=1>"
strNoteBody = strNoteBody & "<TR><TD>"
'Create headings for response table
strNoteBody = strNoteBody &
"Name</TD><TD>Location</TD><TD>Telephone</TD><TD>Response</TD><TR><TD>"
'remove trailing vbcrlf from object before creating html table
objAttendeeOpt = Left(objAttendeeOpt, Len(objAttendeeOpt) - 1)
'Convert vbCrLf to html tags
objAttendeeOpt = Replace(objAttendeeOpt, vbCrLf, "<BR>")
'Convert vbCr to html tags
objAttendeeOpt = Replace(objAttendeeOpt, vbCr, "</TD><TR><TD>")
'convert vbTab to html tags
objAttendeeOpt = Replace(objAttendeeOpt, vbTab, "</TD><TD>")
strNoteBody = strNoteBody & objAttendeeOpt
strNoteBody = strNoteBody & "</TR>"
strNoteBody = strNoteBody & "</TABLE>"
'close table
End If
'insert horizontal line before notes
strNoteBody = strNoteBody & "<HR>"
'insert notes
'Convert vbCrLf to html tags
strNotes = Replace(strNotes, vbCrLf, "<BR>")
strNotes = Replace(strNotes, vbTab, " ")
strNoteBody = strNoteBody & "<P>" & "NOTES:" & "</P>"
strNoteBody = strNoteBody & strNotes
'close html
strNoteBody = strNoteBody & "</BODY>"
strNoteBody = strNoteBody & "</HTML>"
'transfer text to body of item
myMailItem.HTMLBody = strNoteBody
'reveal note to user
myMailItem.Display
'Now send it to the Printer
'myMailItem.PrintOut
'' end outlook
EndClean:
Set objApp = Nothing
Set objItem = Nothing
Set objSelection = Nothing
Set objAttendees = Nothing
End Sub
"Lynn Brown" <LynnBrown> wrote in message
news
A613AA5-F034-4304-966E-C9A99C0AC865@microsoft.com...
The first part prints off a calendar and it shows who was invited, but it
didn't show the responses.
I created the Macro, and followed your steps. I get an error:
"Compile Error:
User-defined type not defined"
When I press the Okay button, it takes me to the following line of code:
"Dim objWord as Word.Application"
I prefer this Macro choice, as when I get it working, I will put it on other
computers (for my bosses who actually want this info). Any suggestions why
the code wouldn't work. I followed your instructions.
Thanks for your help so far, but if I could get this to work, it would be
great.
"Nikki Peterson" wrote:
> http://www.slipstick.com/addins/gallery/index.htm#myolcal
> "My Outlook Calendar: Customizable Word template for generating
> Outlook weekly and monthly calendars. Print any Outlook calendar
> that you have access to, including calendars from other users'
> mailboxes and Public Folders. Add color coding by category or by
> type of item (one-day event, multiple-day event, etc.) Specify time
> and date formats and the title for the calendar. Slower than the
> Microsoft template, but it does much more and follows progress in
> the status bar."
> Choose Weekly and select the "Show Meeting Attendees"
> radio button.
> OR... (I really like using this one):
> If you are up to adding a "macro" to your Outlook
> http://www.outlookcode.com/codedetail.aspx?id=37
> However, it is kinda advanced.
> I'll try to write the steps if you're up to giving it a go:
> 1) Copy all of the code in the BODY of the page (in the link above)
> (The white box in the middle)
> 2) In Outlook, press your <ALT>+<F11
> This opens the Microsoft Visual Basic - VbaProject.OTM
> 3) On the menu select "Insert"
> 4) Select "Module"
> 5) In the blank window on the right, PASTE the code you
> copied
> 6) Select "File"
> 7) Select "Close and Return to Microsoft Outlook"
> 8) Right click on your Tool menu (in the gray part where the buttons are)
> 9) Select "Customize..."
> 10) Click on the "Commands" tab
> 11) Select "Macros" from the Categories
> 12) Click on "Project1.PrintAapptAttendee" and drag it to your toolbar
> and Drop it (You have to drop it ON the toolbar not in the gray
> blank area but next to something like the yellow question mark
> icon)
> 13) Close the Customize window.
> Now try to use this "Macro"
> 1) Open an appointment that has attendees in it
> 2) Click on the "Project1.PrintAapptAttendee" button that you put
> on your toolbar.
> 3) Wait a moment for Word to open and show you your appointment
> with all of the attendees and how they responded to the invitation.
> If you run into any problems, write back.
> Nikki
> "Lynn Brown" <Lynn Brown> wrote in message
> news:F2BAF950-C84A-4869-8DAB-B4D6C8DF0800@microsoft.com...
> Good Day
> I know that in older versions of Outlook, when you would print off a
> meeting, it would also print off all the responses to the meeting, so that
> you knew who was planning on attending, and who couldn't. You can see the
> responses, but this no longer prints off in Outlook 2003. Does anybody
> know
> of a switch or code that can be turned on so that this will start working?
>