Dim sfd As New SaveFileDialog With sfd .AddExtension = True .DefaultExt = ".doc" .Filter = "Word Document Files (*.doc)|*.doc" .FilterIndex = 1 .InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments .Title = "Select The Location To Save This Word File" .ValidateNames = True End With If sfd.ShowDialog() = DialogResult.OK Then Try Dim svLocation As String = sfd.FileName rtbcomplete.SaveFile(svLocation) 'opening the doc file to add header and footer Dim objApp As Word.Application Dim objDoc As Word.Document objApp = New Word.Application() objDoc = objApp.Documents.Open(svLocation) For Each section As Word.Section In objDoc.Sections Dim footerRange As Word.Range = section.Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range footerRange.InlineShapes.AddPicture("E:\Storage\Signed\f.jpg") Dim headerRange As Word.Range = section.Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range headerRange.InlineShapes.AddPicture("E:\Storage\Signed\h.jpg") Next objDoc.Save() objDoc.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)