Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB to Insert GIFS and format Header/footers in MS WORD

Status
Not open for further replies.

onetomany

Programmer
May 15, 2000
55
0
0
US
This is actually two questions.

1.I need to insert a gif file into a word doc before I print it out.Is this possible.

2.I would like to use the header and footer features of word but I cannot figure out how to access them.

I have a program that that opens word writes out a letter adding in values retrieved from a database then printingthe letter. This works fine but i now need to insert a gif and would like to use the header and footer features of word. I am using vb 6 and word 2000.Any help would be appreciated.
 
to start you off

Code:
Option Explicit

Dim WithEvents moWord As Word.Application
Dim WithEvents moDoc As Word.Document

Private Sub Command1_Click()
  Dim oHeader As Word.Range
  Dim oFooter As Word.Range
  
  Set moWord = New Word.Application
  
  Set moDoc = moWord.Documents.Add
  
  With moDoc
    .Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "header text"
    .Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = "footer text"
    .Shapes.AddPicture Anchor:=.Range.Characters.Last, _
                       FileName:="C:\WINDOWS\TEMP\H125.gif", _
                       LinkToFile:=False, _
                       SaveWithDocument:=True
    
  End With
  
  moWord.Visible = True
  
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top