A
Andreas Urban
Hi,
I've a problem writing my Outlook-Tasks to an Excel-Sheet. The VBA-Code
worked fine, once. But now Outlook alwalys hangs up and tells me that a
problem occured and it's got to be closed. While debugging, it seems to me
that the CreateObject("Outlook.Application")-method creates the problem.
This is the last line showed (in single-step-mode) before Outlook hangs up.
I'm using Office XP with an Win2000 operating system. Can anyone help me?
Greets
Andreas
Here's the code i wrote: (I'm not sure if I need all the declare-stuff, I
copied some lines from somewhere.)
Option Explicit
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long
Sub Excel()
Dim XL1 As Object
Dim myolapp As Object, mynamespace As NameSpace, myfolder As Folders,
myitems As Items
Set XL1 = GetObject("c:\test.xls")
XL1.Application.Visible = True
XL1.Parent.Windows(1).Visible = True
XL1.Application.Range("A1") = "Subject"
XL1.Application.Range("B1") = "DueDate"
Set myolapp = CreateObject("Outlook.Application")
Set mynamespace = myolapp.GetNamespace("MAPI")
Set myfolder = mynamespace.GetDefaultFolder(olFolderTasks)
Set myitems = myfolder.Items
XL1.Application.Range("A2") = myitems(i).Subject
XL1.Application.Range("B2") = myitems(i).DueDate
XL1.Application.Quit
Set XL1 = Nothing
End Sub
I've a problem writing my Outlook-Tasks to an Excel-Sheet. The VBA-Code
worked fine, once. But now Outlook alwalys hangs up and tells me that a
problem occured and it's got to be closed. While debugging, it seems to me
that the CreateObject("Outlook.Application")-method creates the problem.
This is the last line showed (in single-step-mode) before Outlook hangs up.
I'm using Office XP with an Win2000 operating system. Can anyone help me?
Greets
Andreas
Here's the code i wrote: (I'm not sure if I need all the declare-stuff, I
copied some lines from somewhere.)
Option Explicit
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long
Sub Excel()
Dim XL1 As Object
Dim myolapp As Object, mynamespace As NameSpace, myfolder As Folders,
myitems As Items
Set XL1 = GetObject("c:\test.xls")
XL1.Application.Visible = True
XL1.Parent.Windows(1).Visible = True
XL1.Application.Range("A1") = "Subject"
XL1.Application.Range("B1") = "DueDate"
Set myolapp = CreateObject("Outlook.Application")
Set mynamespace = myolapp.GetNamespace("MAPI")
Set myfolder = mynamespace.GetDefaultFolder(olFolderTasks)
Set myitems = myfolder.Items
XL1.Application.Range("A2") = myitems(i).Subject
XL1.Application.Range("B2") = myitems(i).DueDate
XL1.Application.Quit
Set XL1 = Nothing
End Sub