Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Indeed yes.
Dim username As String username = "Username" and Environ(username) or Environ("Username") both work fine. Anthony NewBike wrote: so just add a set username as string statement? "Anthony D" wrote: Hi, Thanks for your feedback. Just a minor modification in the Environ call required, to supply username as a string. Environ("Username") Hth Anthony "NewBike" wrote: Thanks, I did have the .Save statement, just didn't in the portion I cut and pasted here. I ended up changing my data some and it works now. My Date and Time were in separate fields, now they in one cell it works. Now I am trying to add the user name to the body text with: Dim olApp As Outlook.Application Dim Appt As Outlook.AppointmentItem Set olApp = CreateObject("Outlook.Application") Set Appt = olApp.CreateItem(olAppointmentItem) With Appt .Start = Range("K7").Value .End = Range("K7").Value .Subject = Range("H7").Value & "/ " & Range("A7").Value & " / " & Range("D7").Value .Body = "Contact: " & Range("e7").Value & vbNewLine & "Contact Phone: " & Range("F7").Value & vbNewLine & "Notified: " & Range("G7").Value & vbNewLine & "PO Verified & Entered by: " & Environ(Username) .ReminderSet = False .Save End With Set Appt = Nothing Set olApp = Nothing But I am getting an Invalid Procedure call (error 5) Any ideas? "Anthony D" wrote: Hi, With start/end date of 24/09/2006 15:00 in L7 I found that this is fine (with reference selected to MS Outlook Object library in Tools, References) Try App.Display or App.Save after your End With statement ? Anthony "NewBike" wrote: Hi again - I am trying to write a macro that when a button is clicked on a spreadsheet, it will use the data entered on the new row to create an appointment in Outlook... The area that I am experiencing difficulty in is the appointment time, duration and body text. Here is my code: Sub SetAppt() Dim olApp As Outlook.Application Dim Appt As Outlook.AppointmentItem Set olApp = CreateObject("Outlook.Application") Set Appt = olApp.CreateItem(olAppointmentItem) With Appt .Start = Range("L7").Value .End = Range("L7").Value .Subject = Range("I7").Value & Range("a7").Value & Range("d7").Value .Body = Range("e7").Value .ReminderSet = False End With Set Appt = Nothing Set olApp = Nothing End Sub Any help is appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to create outlook appointment | Excel Discussion (Misc queries) | |||
outlook appointment labels colour from excel | Excel Discussion (Misc queries) | |||
Pass a time value from Excel to Outlook appointment | Excel Discussion (Misc queries) | |||
Can I cause Excel to post an appointment to Outlook Calendar | Excel Programming | |||
Automatically create outlook appointment | Excel Discussion (Misc queries) |