Anzeige
Archiv - Navigation
888to892
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
888to892
888to892
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Bestimmte Spalten nach Outlook

Bestimmte Spalten nach Outlook
24.07.2007 11:33:00
Mat
Hallo Leute,
ich habe noch zwei Fragen zum Senden von Terminen nach Outlook aus Excel welche mir auf den Nägeln brennen.
Im nachfolgenden Macro wird die Spalte I als Anfangszeit und die Spalte J als Endzeit des Termins übergeben. Bei manchen Terminen befindet sich die Anfangszeit jedoch in Spalte L und die Endzeit in Spalte M (muß leider so sein!).
Kann mir jemand helfen den Code so zu ändern, dass entweder die Spalten I und J, oder wenn diese leer sind die Spalten L und M als Anfangszeit bzw. Endzeit übergeben werden?
Mein zweites Problem ist das die Termine nur dann übergeben werden sollen, wenn in den o. g. Spalten eine Anfangszeit bzw. Endzeit steht!
Herzlichen Dank für jede Hilfe
Viele Grüße
Mat
Code aus dem bestehenden Macro:
iRow = 4
Do Until IsEmpty(Cells(iRow, 1))
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, 9).Value
.End = Cells(iRow, 2).Value + Cells(iRow, 10).Value
.Subject = "Dienst"
.Location = Cells(iRow, 7).Value
.Body = Cells(iRow, 19).Value & " Streifenpartner"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
.Move olCal
End With
iRow = iRow + 1
Loop

8
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Bestimmte Spalten nach Outlook
25.07.2007 08:00:00
AndrRo
Hallo Mat,
die Änderungen sind ergänzt:
iRow = 4
Do Until IsEmpty(Cells(iRow, 1))
Set olApt = olApp.CreateItem(olAppointmentItem)
if isempty(cells(iRow,9)) then SpalteStart=13 else SpalteStart=9 'Änderung der Stalte wenn I gleich leer
if isempty(cells(iRow,10)) then SpalteEnde=14 else SpalteEnde=10 'Änderung der Stalte wenn J gleich leer
if isempty(cells(iRow,SpalteStart))=false and isempty(cells(iRow,SpalteEnde))=false then 'Zulassung wenn Start und Ende enthalten sind
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, SpalteStart).Value
.End = Cells(iRow, 2).Value + Cells(iRow, SpalteEnde).Value
.Subject = "Dienst"
.Location = Cells(iRow, 7).Value
.Body = Cells(iRow, 19).Value & " Streifenpartner"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
.Move olCal
End With
end if
iRow = iRow + 1
Loop
gruss
Andreas

Anzeige
AW: Bestimmte Spalten nach Outlook
25.07.2007 18:10:20
Mat
Hallo Andreas,
ich habe den Code eingebaut, bekomme aber die Meldung "Fehler beim Kopilieren Varialbe nicht definiert!"
"SpalteStart =" ist hierbei markiert!
Gruß Mat

AW: Bestimmte Spalten nach Outlook
25.07.2007 20:26:00
Mat
Hallo Andreas,
nach dem zunächst gemeldeten Fehler habe ich versucht den Code selbst zu ändern. Ich bin zwar weiter gekommen aber der nächste Fehler lautet. Loop ohne Do und das Wort Loop ist blau markiert.
Ich hoffe Du kannst mir helfen!
Gruß Mat
Hier mein Code:
iRow = 4
Do Until IsEmpty(Cells(iRow, 1))
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, 9).Value
If IsEmpty(Cells(iRow, 9)) Then .Start = 13 Else .Start = 9 'Änderung der Stalte wenn I gleich leer
.End = Cells(iRow, 2).Value + Cells(iRow, 10).Value
If IsEmpty(Cells(iRow, 10)) Then .End = 14 Else .End = 10 'Änderung der Stalte wenn J gleich leer
If IsEmpty(Cells(iRow, .Start)) = False And IsEmpty(Cells(iRow, .Ende)) = False Then 'Zulassung wenn Start und Ende enthalten sind
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, .Start).Value
.End = Cells(iRow, 2).Value + Cells(iRow, .Ende).Value
.Subject = "Dienst"
.Location = Cells(iRow, 7).Value
.Body = Cells(iRow, 19).Value & " Streifenpartner"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
End With
iRow = iRow + 1
Loop

Anzeige
AW: Bestimmte Spalten nach Outlook
27.07.2007 14:31:00
gerwas
Hallo Mat
Offensichtlich hast du den code von andreas "etwas" angepaßt, er ist jetzt nur ein völlig anderer...
kopier dir nochmal den code und ergänze direkt unter der Zeile mit Sub () folgendes
Dim SpalteStart, SpalteEnde, iRow
dann sollte es gehen
mfg GerWas
Hallo Mat,
die Änderungen sind ergänzt:
iRow = 4
Do Until IsEmpty(Cells(iRow, 1))
Set olApt = olApp.CreateItem(olAppointmentItem)
if isempty(cells(iRow,9)) then SpalteStart=13 else SpalteStart=9 'Änderung der Stalte wenn I gleich leer
if isempty(cells(iRow,10)) then SpalteEnde=14 else SpalteEnde=10 'Änderung der Stalte wenn J gleich leer
if isempty(cells(iRow,SpalteStart))=false and isempty(cells(iRow,SpalteEnde))=false then 'Zulassung wenn Start und Ende enthalten sind
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, SpalteStart).Value
.End = Cells(iRow, 2).Value + Cells(iRow, SpalteEnde).Value
.Subject = "Dienst"
.Location = Cells(iRow, 7).Value
.Body = Cells(iRow, 19).Value & " Streifenpartner"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
.Move olCal
End With
end if
iRow = iRow + 1
Loop
gruss
Andreas

Anzeige
AW: Bestimmte Spalten nach Outlook
28.07.2007 18:36:40
Mat
Hallo GerWas,
bekomme jetzt den Fehler "Mehrfachdeklaration im aktuellen Gültigkeitsbereich"
iRow As Integer wird dabei blau
Hier ist nochmal der gesamte Code:

Sub WriteCalendar()
Dim SpalteStart, SpalteEnde, iRow
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olCal As Outlook.MAPIFolder
Dim olApt As AppointmentItem
Dim iRow As Integer
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
On Error Resume Next
Set olCal = olNS.GetDefaultFolder(olFolderCalendar).Folders("Training")
If Err Then
Set olCal = olNS.GetDefaultFolder(olFolderCalendar).Folders.Add("Training")
Err.Clear
End If
iRow = 4
Do Until IsEmpty(Cells(iRow, 1))
Set olApt = olApp.CreateItem(olAppointmentItem)
If IsEmpty(Cells(iRow, 9)) Then SpalteStart = 13 Else SpalteStart = 9 'Änderung der Stalte wenn  _
I gleich leer
If IsEmpty(Cells(iRow, 10)) Then SpalteEnde = 14 Else SpalteEnde = 10 'Änderung der Stalte wenn  _
J gleich leer
If IsEmpty(Cells(iRow, SpalteStart)) = False And IsEmpty(Cells(iRow, SpalteEnde)) = False Then ' _
Zulassung wenn Start und Ende enthalten sind
With olApt
.Start = Cells(iRow, 2).Value + Cells(iRow, SpalteStart).Value
.End = Cells(iRow, 2).Value + Cells(iRow, SpalteEnde).Value
.Subject = "Dienst"
.Location = Cells(iRow, 7).Value
.Body = Cells(iRow, 19).Value & " Partner"
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
.Move olCal
End With
End If
iRow = iRow + 1
Loop
ERRORHANDLER:
Set olApt = Nothing
Set olCal = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Sub


Wäre wirklich froh wenn mir hierbei jemand weiterhelfen könnte.
Beste Grüße
Mat

Anzeige
AW: Bestimmte Spalten nach Outlook
28.07.2007 18:39:00
Hajo_Zi
Hallo Mat,
irow ist in Zeile 2 und 7 definiert. Lösche es in Zeile 2.

AW: Bestimmte Spalten nach Outlook
28.07.2007 20:13:33
Mat
Hallo Hajo,
danke super, jetzt bin ich ein ganzes Stück weiter. Ich musste jedoch die Varialbe in Zeile 7 löschen und Zeile 2 behalten.
Mein Problem ist noch, dass wenn die Endzeit über die Datumsgrenze hinausgeht die Uhrzeit nicht übernommen wird, sondern die Länge des Termins auf 30 Min begrenzt wird.
Läßt sich da noch was machen?
Gruß
Mat

AW: Bestimmte Spalten nach Outlook
29.07.2007 14:44:43
Mat
Mein Problem ist noch, dass wenn die Endzeit über die Datumsgrenze hinausgeht die Uhrzeit nicht übernommen wird, sondern die Länge des Termins auf 30 Min begrenzt wird.
Läßt sich da noch was machen?
Gruß
Mat
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige