Hi,
I have some data in my excel sheet, see picture.
Now I want to transfer it to Outlook Calendar.
http://img252.imageshack.us/img252/6...enshot032a.jpg
How can I do that?
I hope someone can help me![]()
I also have a CSV file, if that is easier.
Just let me know if you want more information!
Hi Hatye
See this thread. It sounds like what you're doing http://www.excelforum.com/excel-prog...-calender.html
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Thanks John!
Attached you can find my excel workbook. It is the 2nd sheet that I use when I transfer to Outlook, and the sub I have edited is "Transfer_Outlook" (the one at the top of the module).
It is not working correctly, do you know what's wrong? Nothing is correctly transferred, and I am not a master in VBA.
I look forward for help
-Idar
Hi Hatye
Couple things. This line of code evaluates to 100when you have only 27 rows in column A of Ark2 so you need to delete all the extraneous data below your last row.LR = Ark2.Range("A" & Rows.Count).End(xlUp).Row
Secondlyisn't defined anywhere in the code you posted so, the code isn't finding any records. What is strName and where does the value come from?Public strName As String
Can't test the code until this is defined.
Alternately, simply explain what it is you wish to do. Perhaps I can help.
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
It is because I need to use the sheet for several school subjects, such as math, finance, economy and so on. Therefore I don't know how many rows that are filled. In sheet 1 I paste my school schedule from our web solution (one by one), and I sort it in the second sheet and use IF-formulas. Since different subjects may have different numbers of lessons, I did it that way. Is there a way to fix it?This line of code evaluates to 100
About the secondly, I actually don't know why it is there. I pasted it from the link you sent me. I don't know very much about programming, I usually use the recorder.
What I want to do is transferring from Excel to Outlook Calendar with:
Subject: Column A
Start date: B
Start time: C
End date: D
End time: E
Place: H
Category: I
Body: 1.line: F. 2.line: G
Reminder: None
PS! I have deleted the column "All day event".
Do you understand what I want to do?
Thank you so much for your help; I really appreciate it!!
Hi Hatye
Yes, II'll work on this for you.understand what I want to do
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Hi Hatye
You'll notice that I made very few changes to your original code; your offsets were off.Let me know of issues.Option Explicit Sub Transfer_Outlook() Dim objApp As Outlook.Application Dim objNS As Outlook.Namespace Dim objFolder As Outlook.MAPIFolder Dim objRecip As Outlook.Recipient Dim objAppt As Outlook.AppointmentItem Dim UseSubject As String Dim UseLocation As String Dim UseBody As String Dim UseDate As Date Dim UseCategory As String Dim LR As Long Dim nCell As Range Dim Rng As Range Dim StartTime As String Dim EndTime As String On Error Resume Next Set objApp = CreateObject("Outlook.Application") On Error GoTo 0 LR = Ark2.Range("A" & Rows.Count).End(xlUp).Row Set Rng = Ark2.Range("A2:A" & LR) For Each nCell In Rng If Not nCell = "" Then On Error Resume Next Set objNS = objApp.GetNamespace("MAPI") Set objFolder = objNS.GetDefaultFolder(olFolderCalendar) UseSubject = nCell.Offset(0, 0).Value '& " - " & nCell.Offset(0, -4).Value UseDate = nCell.Offset(0, 1).Value UseLocation = nCell.Offset(0, 7).Value UseBody = nCell.Offset(0, 6).Value UseCategory = nCell.Offset(0, 8).Value StartTime = nCell.Offset(0, 2).Value EndTime = nCell.Offset(0, 4).Value If Not objFolder Is Nothing Then Set objAppt = objFolder.Items.Add If Not objAppt Is Nothing Then With objAppt .Start = UseDate + StartTime .End = UseDate + EndTime .Subject = UseSubject .Location = UseLocation .Body = UseBody .Category = UseCategory .Save End With End If Else 'MsgBox "Could not find " & Chr(34) & nCell & Chr(34), , _ "User not found" End If On Error GoTo 0 End If Next nCell Set objApp = Nothing Set objNS = Nothing Set objFolder = Nothing Set objRecip = Nothing Set objAppt = Nothing End Sub
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
I have only one question. It don't categorizes. Do you know what's wrong?Let me know of issues.
Hi Hatye
I assume you have "Skole" set up as a Category in Outlook. Assuming you do, you need to change this line of code fromto.Category = UseCategoryLet me know of issues..Categories = UseCategory
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Hi again, and thank you for respondingLet me know of issues.
In Outlook I have a category called "Skole" (Norwegian for school).
I have tried both "Category", "Categorise" and "Categorize" without any luck.
Do you know what's wrong; and is it working for you?
Hi Hatye
Have you tried Categories ?
Yes, the above code works for me..Categories = UseCategory
John
Last edited by jaslake; 01-09-2011 at 03:00 PM.
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Oh, I must have miss-spelt it. Now it works great!
Thank you so much for help and patienceI couldn't have done this without you!
Sub tst() sq = Sheets(1).Cells(1).CurrentRegion With CreateObject("outlook.application") For j = 2 To UBound(sq) With .createitem(1) .Subject=sq(j,1) .Start=sq(j,2) + sq(j,3) .End=sq(j,4) + sq(j,5) .Body=sq(j,7) .Location=sq(j,8) .Categories=sq(j,9) .Save End With Next End With End Sub
Last edited by snb; 01-09-2011 at 04:33 PM.
Glad it works for you. If your issue is resolved, please mark your thread solved.
John
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks