Menu

 

Thursday, July 29, 2010

Refernce-Collection :- (E) Editors, Email Signature Entries,Endnotes

VBA Code :-

Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

C# Code :-

public void Editor()
{
Word.Editors objEditor = this.Application.Selection.Editors;
object editors = Word.WdEditorType.wdEditorCurrent;
this.Application.Selection.Editors.Add(ref editors);

}

VBA Code :-

Sub NewEmailSignature()
With Application.EmailOptions.EmailSignature
.EmailSignatureEntries.Add "Jeff Smith", Selection.Range
.NewMessageSignature = "Jeff Smith"
End With
End Sub

C# Code :-

public void NewEmailSignature()
{
string name = "Avinash";
this.Application.EmailOptions.EmailSignature.EmailSignatureEntries.Add(name, Application.Selection.Range);

this.Application.EmailOptions.EmailSignature.NewMessageSignature = "Avinash Tiwari";
}

VBA Code :-

ActiveDocument.Endnotes.Location = wdEndOfSection

C# Code :-

public void EndNotesLoc()
{
ThisApplication.ActiveDocument.Endnotes.Location = Microsoft.Office.Interop.Word.WdEndnoteLocation.wdEndOfSection;
}

VBA Code :-

Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Endnotes.Add Range:=Selection.Range , _
Text:="The Willow Tree, (Lone Creek Press, 1996)."

C# Code :-

public void CollpaseDir()
{
object Director = Word.WdCollapseDirection.wdCollapseEnd;

ThisApplication.Selection.Collapse(ref Director);


Word.Range range = ThisApplication.Selection.Range;
object text = "The Willow Tree, (Lone Creek Press, 1996).";

ThisApplication.ActiveDocument.Endnotes.Add(range, ref missing, ref text);
}

VB Code :-

If Selection.Endnotes.Count >= 1 Then
Selection.Endnotes(1).Reference.Font.ColorIndex = wdRed
End If

C# Code :-

public void selection()
{
int endNotesCount = ThisApplication.Selection.Endnotes.Count;

if (endNotesCount >= 1)
{
ThisApplication.Selection.Endnotes[1].Reference.Font.ColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdRed;
}
}

2 comments:

  1. I am a newbie to coding so could not understand all the code myself.As its labeled reference collection so I can understand the reason why details are not provided.But can you give a brief on these that can help me understand this completely.Thanks
    public key infrastructure

    ReplyDelete