Need help using Excel to create Outlook reminders

furstukin

Board Regular
Joined
Apr 22, 2011
Messages
71
I have found several codes to create a calendar reminder and I have worked out one that should be perfect for me, but I have one problem.

The body of the calendar event needs to be everything in cell A1:I50 which includes a small logo picture. I have declared this as SBORDER, but the problem I have is what tpye of variable can I use for this? I have tried Object but it says I have not defined it using a "with" statement and I have tried Range, but I get the same error. I also tried String but it says that I can't use a range of cells as a String.

here is my code

Code:
Function AddOutLookAppt()
Dim appOutLook As Outlook.Application
Dim ApptOutLook As Outlook.AppointmentItem
Dim STARDATE As Date
Dim ENDDATE As Date
Dim SBORDER As String
STARDATE = Range("E15").Value
ENDDATE = Range("E15").Value
SBORDER = Range("A1:I50").Value
Set appOutLook = CreateObject("Outlook.Application")
Set ApptOutLook = appOutLook.CreateItem(olAppointmentItem)
With ApptOutLook
.Start = STARTDATE
.End = ENDDATE
.AllDayEvent = True
.Subject = "Order Due in Two Days"
.Location = ""
.Body = SBORDER
.BusyStatus = olFree
.ReminderSet = True
.ReminderMinutesBeforeStart = 0
.Save
End With
End Function

Any help on this would be greatly appreciated as always.

Also a very helpful tip I found on this forum to anyone trying to use this function. You need to go to the VBA editor under tools and references then enable the Microsoft Outlook 12.0 Object Library or you will get a user type not defined error.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I found one useful macro that allosws me to select my entire range and place it on the clipboard as a picture.

Code:
Range("A1:I50").CopyPicture Appearance:=xlScreen, Format:=xlPicture

But for the life of me I can not figure out how to paste that into my message.

I have tried all sorts of stuff including this.

Code:
Option Explicit
Sub AddOutLookAppt()
Dim appOutLook As Outlook.Application
Dim ApptOutLook As Outlook.AppointmentItem
Dim STARTDATE As String
Dim ENDDATE As String
Dim SBORDER As String
Application.ScreenUpdating = True
ThisWorkbook.Activate
Sheets("Existing Customer SB").Activate
STARTDATE = Range("O1").Value
ENDDATE = Range("O2").Value
Range("A1:I50").CopyPicture Appearance:=xlScreen, Format:=xlPicture
Sheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
SBORDER = Worksheets("Sheet1").Shapes("Picture 1")
Set appOutLook = CreateObject("Outlook.Application")
Set ApptOutLook = appOutLook.CreateItem(olAppointmentItem)
With ApptOutLook
.Start = STARTDATE
.End = ENDDATE
.AllDayEvent = True
.Subject = "Order Due in Two Days"
.Location = ""
.Body = SBORDER
.BusyStatus = olFree
.ReminderSet = True
.ReminderMinutesBeforeStart = 0
.Save
End With
End Sub

But this just tels me it does not support this property or method when trying to declare the SBORDER line as the sheet1 picture.

Someone please help me this is driving me nutz.
 
Upvote 0
You can't assign a shape ("Picture 1") to a string variable, only to a Shape object. You can only assign a string to the appointment's Body property, so SBORDER must be a string. Try changing the .Save to .Display and calling SendKeys to paste (Ctrl+v) the clipboard.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top