2017-07-26 5 views
0

誰かが私を助けることができるかどうかは疑問だった。私はコーディングに非常に慣れており、共有Outlookのカレンダーで1日のイベントを予約するマクロを作成しようとしています。私はインターネットの深みを探し、何も見つけられないようだ。VBA/Excelを使ったOutlookのパブリックカレンダーで予約を予約

私は以下のコードを使用して、ワークブックの範囲で日付と時刻をピックアップし、Outlookの次の共有予定表 "\ UK Public Folders \ Customer Services \ UKカスタマーサービスカレンダー"に入れようとしていますしかし、私はちょうどフォルダパスを定義する運がない。誰も助けることができますか?

Option Explicit 

Sub CreateOutlookAppointment() 

Dim strCategory As String, strTopic As String, strLocation As String, strStartdate As String, strStarttime As String 
Dim strEnddate As String, strEndtime As String, strDuration As String, bolWholeday As Boolean, bolReminder As Boolean, lngReminderMinutes As Long 
Dim bolPlaysound As Boolean, strParticipants As String, bolRespondNecessary As Boolean, strNote As String 


Dim strCategory As String, strTopic As String, strLocation As String, strStartdate As String, strStarttime As String 
Dim strEnddate As String, strEndtime As String, strDuration As String, bolWholeday As Boolean, bolReminder As Boolean, lngReminderMinutes As Long 
Dim bolPlaysound As Boolean, strParticipants As String, bolRespondNecessary As Boolean, strNote As String 

Dim olApp As Object 
Dim objCal As Object 
Dim olCal As Object 

Set olApp = CreateObject("Outlook.Application") 
Set objCal = olApp.Session.GetDefaultFolder(9) 
Set olCal = objCal.Items.Add(1) 



'============================================================= 
'Entries for appointment 
'============================================================= 
strCategory = "Holiday" 
strTopic = Range("Employee3") 
strLocation = "" 
strStartdate = Range("FROM1") 
strStarttime = "09:00" 
strEnddate = Range("FROM2") 
strEndtime = "09:00" 
strDuration = "60" 'If duration of appointment necessary, remove comment for "Duration" below 
bolWholeday = True 
bolReminder = True 
lngReminderMinutes = 10 
bolPlaysound = True 
strParticipants = Range("A8").Value 
bolRespondNecessary = False 
strNote = "Your On Holiday" 
'============================================================= 

'Create appointment 
With olCal 
    .Categories = strCategory 
    .Subject = strTopic 
    .Location = strLocation 
    .Start = strStartdate & " " & strStarttime 
    .End = strEnddate & " " & strEndtime 
    '.Duration = strDuration 'If duration is given about, remove comment 
    .AllDayEvent = bolWholeday 
    .ReminderSet = bolReminder 
    .ReminderMinutesBeforeStart = lngReminderMinutes 
    .ReminderPlaySound = bolPlaysound 
    .Recipients.Add strParticipants 
    .ResponseRequested = bolRespondNecessary 
    .Body = strNote 
    .Display 
End With 

On Error Resume Next 
Set olCal = Nothing 
Set olApp = Nothing 

End Sub 

任意のヘルプは大

多くのおかげ

ジェイミーをいただければ幸いです

答えて

0

エラーコードやエラーメッセージは何ですか? エラーの再開次へエラーメッセージを非表示にするには?しない!

+0

実行時に何も起こりません。その後エラーは表示されません。私はそれをデバッグしようとしましたが、コードを実行するだけです。私が間違って行ったことはうまくいきません。コーディングに経験がないため、どこから始めるべきかわからない –

+0

開始点(F9)の後のどこかにブレークポイントを設定してください。ヒットしたら、F8でコードをステップ実行します。 – peakpeak