½Ð°Ý¤@¤UVBA¥i¥H§ì¯S©w¤é´Á½d³òªºOUTLOOK¦æ¨Æ¾ä¦^¨Ó¶Ü?
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 79
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- SP2
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-30
- ³Ì«áµn¿ý
- 2024-11-15
|
½Ð°Ý¤@¤UVBA¥i¥H§ì¯S©w¤é´Á½d³òªºOUTLOOK¦æ¨Æ¾ä¦^¨Ó¶Ü?
POWERQUERY¨ú¸ê®Æ³t«×¤ñ¸ûºC¡A½d³ò¤]«Ü¤j
¤£¾å±oVBA¯à¤£¯àª½±µ¦s¨ú? |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 79
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- SP2
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-30
- ³Ì«áµn¿ý
- 2024-11-15
|
https://www.mrexcel.com/board/threads/outlook-calendar-vba.816885/
¦³§ä¨ì³oÓ½d¨Ò¡A¥i¬O¥¦§ì¨ì"¦æ¨Æ¾ä"¡A§Ú·Q§ìªº¬O"¦@¥Î¦æ¨Æ¾ä"
½Ð°Ýnק墨¸Ì¡H |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 79
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- SP2
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-30
- ³Ì«áµn¿ý
- 2024-11-15
|
§Ú¤v¸g§ì¨ì·Qnªº¦æ¨Æ¾ä¤F~~ |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 79
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- SP2
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-30
- ³Ì«áµn¿ý
- 2024-11-15
|
- Public Sub ListAppointments()
- On Error GoTo ErrHand:
- Application.ScreenUpdating = False
- 'This is an enumeration value in context of getDefaultSharedFolder
- Const olFolderCalendar As Byte = 9
- Dim olApp As Object: Set olApp = CreateObject("Outlook.Application")
- Dim olNS As Object: Set olNS = olApp.GetNamespace("MAPI")
- Dim olFolder As Object
- Dim olApt As Object
- Dim objOwner As Object: Set objOwner = olNS.CreateRecipient("¦Û¤vªºEMAIL")
- Dim NextRow As Long
- Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sheet1")
- Dim FromDate As Date
- Dim ToDate As Date
-
-
- objOwner.Resolve
- If objOwner.Resolved Then
- Set olFolder = olNS.GetSharedDefaultFolder(objOwner, olFolderCalendar).Folders("¦@¥Î¦æ¨Æ¾ä")
- End If
- ws.Range("A1:D1").Value2 = Array("Subject", "Start", "End", "Location")
- 'Ensure there at least 1 item to continue
- If olFolder.Items.Count = 0 Then Exit Sub
- 'Create an array large enough to hold all records
- Dim myArr() As Variant: ReDim myArr(0 To 3, 0 To olFolder.Items.Count - 1)
- 'Add the records to an array
- 'Add this error skip, as I found some of my calendar items don't have all properties e.g. a start time
- On Error Resume Next
- FromDate = InputBox("Enter the start date (format: yyyy/mm/dd)")
- ToDate = InputBox("Enter the end date(format: yyyy/mm/dd)")
- For Each olApt In olFolder.Items
- If (olApt.Start >= FromDate And olApt.Start <= ToDate) Then
- myArr(0, NextRow) = olApt.Subject
- myArr(1, NextRow) = olApt.Start
- myArr(2, NextRow) = olApt.End
- myArr(3, NextRow) = olApt.Categories
- NextRow = NextRow + 1
- Else
- End If
- Next
- On Error GoTo 0
- 'Write all records to a worksheet from an array, this is much faster
- ws.Range("A2:D" & NextRow + 1).Value = WorksheetFunction.Transpose(myArr)
- 'AutoFit
- ws.Columns.AutoFit
- cleanExit:
- Application.ScreenUpdating = True
- Exit Sub
- ErrHand:
- 'Add error handler
- Resume cleanExit
- End Sub
½Æ»s¥N½X
¥H¤W³o¼Ë´N¯à¨ú¥X¦@¥Î¦æ¨Æ¾ä¸Ìªº¸ê®Æ |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 79
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- SP2
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-30
- ³Ì«áµn¿ý
- 2024-11-15
|
½Ð°Ý¤@¤UmyArr(4, NextRow) = n¼W¥[¤@ÓAllDayEventn«ç»ò¼g?
èµo²{¥þ¤Ñ¨Æ¥óªºµ²§ô¤é´Á·|¦h¤F¤@¤Ñ¥X¨Ó¡A·Q§ì¥þ¤Ñ¨Æ¥ó¦^¨Ó¦A§ï¼g
¥i¬O¤£·|¼g |
|
|
|
|
|
|