ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Appointment (https://www.excelbanter.com/excel-programming/297884-set-appointment.html)

Be Guy

Set Appointment
 
The code below works fine as is. However if I change the
value for the myItem.Start to 'Range("B1").value and copy
and past this value into 'B1', it errors with 'Type
Mismatch: Unable to coerce parameter value ... Tried .Text
same result different error. What am I missing here?

Sub AppointSet()
Dim myItem, myOlapp
Set myOlapp = CreateObject("Outlook.Application")
Set myItem = myOlapp.CreateItem(olAppointmentItem)
myItem.Subject = Range("A1") 'value is "Testing"
myItem.Location = "Conference Room B"
myItem.Start = #5/11/2004 10:00:00 AM#
myItem.Duration = Range("C1").Value 'value is 30
myItem.Save
End Sub

Thanks
Be Guy

Bob Phillips[_6_]

Set Appointment
 
Not sure exactly what you mean by '... copy and past this value into 'B1'
....', but I just ran it referring myItem.Start to range("B1"), with a
date-time in B1 and it ran fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Be Guy" wrote in message
...
The code below works fine as is. However if I change the
value for the myItem.Start to 'Range("B1").value and copy
and past this value into 'B1', it errors with 'Type
Mismatch: Unable to coerce parameter value ... Tried .Text
same result different error. What am I missing here?

Sub AppointSet()
Dim myItem, myOlapp
Set myOlapp = CreateObject("Outlook.Application")
Set myItem = myOlapp.CreateItem(olAppointmentItem)
myItem.Subject = Range("A1") 'value is "Testing"
myItem.Location = "Conference Room B"
myItem.Start = #5/11/2004 10:00:00 AM#
myItem.Duration = Range("C1").Value 'value is 30
myItem.Save
End Sub

Thanks
Be Guy




Be Guy

Set Appointment
 
Should have been copy and paste. For me it will not read
from the cell reference. Did you format 'B1' to 'date-
time'?
Be Guy

-----Original Message-----
Not sure exactly what you mean by '... copy and past

this value into 'B1'
....', but I just ran it referring myItem.Start to range

("B1"), with a
date-time in B1 and it ran fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Be Guy" wrote in

message
...
The code below works fine as is. However if I change the
value for the myItem.Start to 'Range("B1").value and

copy
and past this value into 'B1', it errors with 'Type
Mismatch: Unable to coerce parameter value ...

Tried .Text
same result different error. What am I missing here?

Sub AppointSet()
Dim myItem, myOlapp
Set myOlapp = CreateObject("Outlook.Application")
Set myItem = myOlapp.CreateItem(olAppointmentItem)
myItem.Subject = Range("A1") 'value is "Testing"
myItem.Location = "Conference Room B"
myItem.Start = #5/11/2004 10:00:00 AM#
myItem.Duration = Range("C1").Value 'value is 30
myItem.Save
End Sub

Thanks
Be Guy



.


Bob Phillips[_6_]

Set Appointment
 
Yeah I got the copy and paste. My question was really asking why you did, or
suggested that, as I could use the value in B1 without any copying and
pasting.

I simply typed a date/time value into B1, which then took a date format.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Be Guy" wrote in message
...
Should have been copy and paste. For me it will not read
from the cell reference. Did you format 'B1' to 'date-
time'?
Be Guy

-----Original Message-----
Not sure exactly what you mean by '... copy and past

this value into 'B1'
....', but I just ran it referring myItem.Start to range

("B1"), with a
date-time in B1 and it ran fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Be Guy" wrote in

message
...
The code below works fine as is. However if I change the
value for the myItem.Start to 'Range("B1").value and

copy
and past this value into 'B1', it errors with 'Type
Mismatch: Unable to coerce parameter value ...

Tried .Text
same result different error. What am I missing here?

Sub AppointSet()
Dim myItem, myOlapp
Set myOlapp = CreateObject("Outlook.Application")
Set myItem = myOlapp.CreateItem(olAppointmentItem)
myItem.Subject = Range("A1") 'value is "Testing"
myItem.Location = "Conference Room B"
myItem.Start = #5/11/2004 10:00:00 AM#
myItem.Duration = Range("C1").Value 'value is 30
myItem.Save
End Sub

Thanks
Be Guy



.




Be Guy

Set Appointment
 
Oops, the intent was to show that what worked within the
body of the macro would not work (for me) in the cell or
vice versa what is typed in cell (and doesn't work) does
work when pasted into the macro. The idea being that there
wasn't a typo. This is strange, have tried it on Word 97,
Office XP Pro along with Office 2000 and it won't work for
me.
I'm using a workbook for purchase recordkeeping and want
to add the functionality (within Excel) of having an
appointment sent to Outlook for a popup when something is
due. Outlook is always open but Excel is not.

Any and all suggestions or links greatly appreciated.

Thanks,
Be Guy
-----Original Message-----
Yeah I got the copy and paste. My question was really

asking why you did, or
suggested that, as I could use the value in B1 without

any copying and
pasting.

I simply typed a date/time value into B1, which then took

a date format.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Be Guy" wrote in

message
...
Should have been copy and paste. For me it will not read
from the cell reference. Did you format 'B1' to 'date-
time'?
Be Guy

-----Original Message-----
Not sure exactly what you mean by '... copy and past

this value into 'B1'
....', but I just ran it referring myItem.Start to

range
("B1"), with a
date-time in B1 and it ran fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Be Guy" wrote in

message
...
The code below works fine as is. However if I change

the
value for the myItem.Start to 'Range("B1").value and

copy
and past this value into 'B1', it errors with 'Type
Mismatch: Unable to coerce parameter value ...

Tried .Text
same result different error. What am I missing here?

Sub AppointSet()
Dim myItem, myOlapp
Set myOlapp = CreateObject("Outlook.Application")
Set myItem = myOlapp.CreateItem(olAppointmentItem)
myItem.Subject = Range("A1") 'value is "Testing"
myItem.Location = "Conference Room B"
myItem.Start = #5/11/2004 10:00:00 AM#
myItem.Duration = Range("C1").Value 'value is 30
myItem.Save
End Sub

Thanks
Be Guy


.



.



All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com