P
Pankaj
Hello guys,
I have given the code below.
I am working in Visual Studio 2005, VB project I have selected.
I have also written in code where is the problem & leave some space
before & after that.
Please see it & paste it in VS 2005.
And if u come up with the solution please tell me.
Okay thanks.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim calendar As Outlook.MAPIFolder
Dim myCalItems As Outlook.Items
Dim myItem
Dim tablenew
Dim C1, C2 As Integer
Dim R1, R2 As Integer
Dim D1 As Date
Dim D2 As Date
Dim WordApp As New Word.Application()
WordApp.Documents.Add(DocumentType:=Word.WdNewDocumentType.wdNewBlankDocument)
WordApp.Application.ActiveDocument.Tables.Add(Range:=WordApp.Application.Selection.Range,
NumRows:=1, NumColumns:= _
3,
DefaultTableBehavior:=Word.WdDefaultTableBehavior.wdWord9TableBehavior,
AutoFitBehavior:= _
Word.WdAutoFitBehavior.wdAutoFitFixed)
With WordApp.Application.Selection.Tables(1)
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
myolApp = CreateObject("Outlook.Application")
myNamespace = myolApp.GetNamespace("MAPI")
calendar =
myNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
myCalItems = calendar.Items
C1 = 1
R1 = 1
For Each myItem In myCalItems
If (myItem.Categories = "KT") Then
' TextBox1.AppendText(myItem.Subject & " " &
myItem.Categories & " " & myItem.Duration & vbCrLf)
' Dim ModifiedDate As Word.CustomProperty =
WordApp.Application.ActiveDocument.CustomDocumentProperties.add( _
' "ModifiedDate", myItem.Start)
' PROBLEM IS WITH THIS ISSUE THAT PORTION IS IN STARS
GIVES "UNSPECIFIED ERROR"
Dim DocProp
Dim DocProp1
DocProp1 = WordApp.Application.ActiveDocument
********* DocProp =
DocProp1.CustomDocumentProperties.add(Name:="ModifiedDate", _
LinkToContent:=False, _
Type:=MsoDocProperties.msoPropertyTypeDate, _
Value:=myItem.Start) ********
********* ' With
WordApp.Application.ActiveDocument.CustomDocumentProperties
'.Add(Name:="CustomNumber", _
' LinkToContent:=False, _
' Type:=MsoDocProperties.msoPropertyTypeDate, _
' Value:=myItem.Start)
'End With ********
If (C1 = 1 And R1 = 1) Then
WordApp.Application.Selection.Tables(1).Cell(R1,
C1).Range.InsertAfter(myItem.Start)
C1 = C1 + 1
Else
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Start)
End If
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Duration)
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Subject)
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1).Name =
"ModifiedDate"
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1) =
myItem.Start
End If
Next
'' saveAs.ShowDialog()
'' WordApp.ActiveDocument.SaveAs(saveAs.FileName)
''WordApp.ActiveDocument.Close()
'WordApp.ActiveDocument.SaveAs("C:\abc.doc")
'WordApp.ActiveDocument.Close() * /
' WordApp.Documents.Open("C:\abc.doc")
'GOING TO THE LAST ROW & LAST COLUMN
tablenew = WordApp.Application.ActiveDocument.Tables(1)
C1 = tablenew.Columns.Count
R1 = tablenew.Rows.Count
' D1 =
WordApp.Application.ActiveDocument.CustomDocumentProperties(1).Value.ToString()
'WordApp.Application.Selection.TypeText(D1)
'WordApp.Application.Selection.TypeText(System.DateTime.Today)
' /*If (D1 < System.DateTime.Today) Then
'For Each myItem In myCalItems
'If (myItem.Start > D1 And myItem.Categories = "KT") Then
'WordApp.Application.ActiveDocument.Tables(1).Rows.Add()
'C1 =
WordApp.Application.ActiveDocument.Tables(1).Columns.Count
'R1 = WordApp.Application.ActiveDocument.Tables(1).Rows.Count
'tablenew.Cell(R1, C1 - 2).Range.InsertAfter(myItem.Start)
'tablenew.Cell(R1, C1 - 1).Range.InsertAfter(myItem.Duration)
'tablenew.Cell(R1, C1).Range.InsertAfter(myItem.Subject)
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1)
= myItem.Start
'End If
'Next
'If (C1 > C2) Then
'
WordApp.Application.ActiveDocument.CustomDocumentProperties(1) =
System.DateTime.Today
'End If
'End If
WordApp.ActiveDocument.SaveAs("C:\abc.doc")
WordApp.ActiveDocument.Close()
End Sub
End Class
I have given the code below.
I am working in Visual Studio 2005, VB project I have selected.
I have also written in code where is the problem & leave some space
before & after that.
Please see it & paste it in VS 2005.
And if u come up with the solution please tell me.
Okay thanks.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim calendar As Outlook.MAPIFolder
Dim myCalItems As Outlook.Items
Dim myItem
Dim tablenew
Dim C1, C2 As Integer
Dim R1, R2 As Integer
Dim D1 As Date
Dim D2 As Date
Dim WordApp As New Word.Application()
WordApp.Documents.Add(DocumentType:=Word.WdNewDocumentType.wdNewBlankDocument)
WordApp.Application.ActiveDocument.Tables.Add(Range:=WordApp.Application.Selection.Range,
NumRows:=1, NumColumns:= _
3,
DefaultTableBehavior:=Word.WdDefaultTableBehavior.wdWord9TableBehavior,
AutoFitBehavior:= _
Word.WdAutoFitBehavior.wdAutoFitFixed)
With WordApp.Application.Selection.Tables(1)
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
myolApp = CreateObject("Outlook.Application")
myNamespace = myolApp.GetNamespace("MAPI")
calendar =
myNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
myCalItems = calendar.Items
C1 = 1
R1 = 1
For Each myItem In myCalItems
If (myItem.Categories = "KT") Then
' TextBox1.AppendText(myItem.Subject & " " &
myItem.Categories & " " & myItem.Duration & vbCrLf)
' Dim ModifiedDate As Word.CustomProperty =
WordApp.Application.ActiveDocument.CustomDocumentProperties.add( _
' "ModifiedDate", myItem.Start)
' PROBLEM IS WITH THIS ISSUE THAT PORTION IS IN STARS
GIVES "UNSPECIFIED ERROR"
Dim DocProp
Dim DocProp1
DocProp1 = WordApp.Application.ActiveDocument
********* DocProp =
DocProp1.CustomDocumentProperties.add(Name:="ModifiedDate", _
LinkToContent:=False, _
Type:=MsoDocProperties.msoPropertyTypeDate, _
Value:=myItem.Start) ********
********* ' With
WordApp.Application.ActiveDocument.CustomDocumentProperties
'.Add(Name:="CustomNumber", _
' LinkToContent:=False, _
' Type:=MsoDocProperties.msoPropertyTypeDate, _
' Value:=myItem.Start)
'End With ********
If (C1 = 1 And R1 = 1) Then
WordApp.Application.Selection.Tables(1).Cell(R1,
C1).Range.InsertAfter(myItem.Start)
C1 = C1 + 1
Else
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Start)
End If
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Duration)
WordApp.Application.Selection.MoveRight(Unit:=Word.WdUnits.wdCell)
WordApp.Application.Selection.TypeText(Text:=myItem.Subject)
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1).Name =
"ModifiedDate"
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1) =
myItem.Start
End If
Next
'' saveAs.ShowDialog()
'' WordApp.ActiveDocument.SaveAs(saveAs.FileName)
''WordApp.ActiveDocument.Close()
'WordApp.ActiveDocument.SaveAs("C:\abc.doc")
'WordApp.ActiveDocument.Close() * /
' WordApp.Documents.Open("C:\abc.doc")
'GOING TO THE LAST ROW & LAST COLUMN
tablenew = WordApp.Application.ActiveDocument.Tables(1)
C1 = tablenew.Columns.Count
R1 = tablenew.Rows.Count
' D1 =
WordApp.Application.ActiveDocument.CustomDocumentProperties(1).Value.ToString()
'WordApp.Application.Selection.TypeText(D1)
'WordApp.Application.Selection.TypeText(System.DateTime.Today)
' /*If (D1 < System.DateTime.Today) Then
'For Each myItem In myCalItems
'If (myItem.Start > D1 And myItem.Categories = "KT") Then
'WordApp.Application.ActiveDocument.Tables(1).Rows.Add()
'C1 =
WordApp.Application.ActiveDocument.Tables(1).Columns.Count
'R1 = WordApp.Application.ActiveDocument.Tables(1).Rows.Count
'tablenew.Cell(R1, C1 - 2).Range.InsertAfter(myItem.Start)
'tablenew.Cell(R1, C1 - 1).Range.InsertAfter(myItem.Duration)
'tablenew.Cell(R1, C1).Range.InsertAfter(myItem.Subject)
'WordApp.Application.ActiveDocument.CustomDocumentProperties(1)
= myItem.Start
'End If
'Next
'If (C1 > C2) Then
'
WordApp.Application.ActiveDocument.CustomDocumentProperties(1) =
System.DateTime.Today
'End If
'End If
WordApp.ActiveDocument.SaveAs("C:\abc.doc")
WordApp.ActiveDocument.Close()
End Sub
End Class