Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

VB
Private Sub Command1_Click()
    Dim MyWord As Word.Application, WordDoc As Word.Document

    Set MyWord = New Word.Application
    Set WordDoc = MyWord.Documents.Add

    AddWaterMark WordDoc

    MyWord.Visible = True
End Sub


Private Sub AddWaterMark(pDoc As Word.Document)
    pDoc.Shapes.AddTextEffect 0, "ULTRA SECRET", "Century Gothic", 1, False, False, 0, 0
    pDoc.Shapes(1).Name = "PowerPlusWaterMarkObject1"
    pDoc.Shapes(1).TextEffect.NormalizedHeight = False
    pDoc.Shapes(1).Line.Visible = False
    pDoc.Shapes(1).Fill.Visible = True
    pDoc.Shapes(1).Fill.Solid
    pDoc.Shapes(1).Fill.ForeColor.RGB = RGB(0, 255, 255)
    pDoc.Shapes(1).Fill.Transparency = 0.8
    pDoc.Shapes(1).Rotation = 315
    pDoc.Shapes(1).LockAspectRatio = True
    pDoc.Shapes(1).Height = 80
    pDoc.Shapes(1).Width = 520
    pDoc.Shapes(1).WrapFormat.AllowOverlap = True
    pDoc.Shapes(1).WrapFormat.Side = wdWrapNone
    pDoc.Shapes(1).WrapFormat.Type = 3
    pDoc.Shapes(1).RelativeHorizontalPosition = wdRelativeVerticalPositionMargin
    pDoc.Shapes(1).RelativeVerticalPosition = wdRelativeVerticalPositionMargin
    pDoc.Shapes(1).Left = wdShapeCenter
    pDoc.Shapes(1).Top = wdShapeCenter
End Sub
Posted
Comments
george4986 17-Sep-14 3:01am    
if its working code in VB then use http://converter.telerik.com/

here is the link http://codeconverter.sharpdevelop.net/SnippetConverter.aspx
 
Share this answer
 
Try this code (not a translator): [^].
 
Share this answer
 
Any effort? If you Google[^], there are already many online convertors available.

This one has worked fine for me over the years:

http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900