Try oWord = GetObject(, "Word.Application") oDoc = oWord.ActiveDocument Dim ttl As String = oDoc.Name Label1.Text = ttl Dim clr As Color = Color.FromArgb(128, 128, 0) Try oDoc.Background.Fill.BackColor.RGB = ColorTranslator.ToOle(clr) oDoc.Background.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoCTrue oDoc.Background.Fill.Solid() Catch ex As Exception MsgBox("Second TryCatch - " & ex.Message) End Try Catch ex As Exception Label1.Text = "Object Error" End Try
ColorTranslator
msoCTrue
Dim oDoc As Document = Nothing 'later oDoc = ActiveDocument With oDoc .Background.Fill.ForeColor.RGB = RGB(128, 128, 0) .Background.Fill.Visible = msoTrue .Background.Fill.Solid End With oDoc = Nothing
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)