General discussion


urgent help from VBA Expert

By fanku ·
'Dim Cell As Range
Dim myWord As Object
Dim PathDocu As String

Set myWord = CreateObject("word.application")
'Set myWord = GetObject(, "Word.Application")

Set myWord = GetObject("g:\global\mahesh\offer letter.doc")
myWord.Application.Visible = True
'PathDocu = "G:\global\mahesh\"

With myWord
'Documents.Open (PathDocu & "offer letter.doc")
myWord.ActiveDocument.Bookmarks("date").Range.Text = Format(Date, "dd mmmm yyyy")
myWord.ActiveDocument.ActiveDocument.Bookmarks("firstname").Range.txt = Me.fname
myWord.ActiveDocument.Bookmarks("lname").Range.Text = Me.lname
myWord.ActiveDocument.Bookmarks("add1").Range.Text = Me.add1
myWord.ActiveDocument.Bookmarks("add2").Range.Text = Me.add2
myWord.ActiveDocument.Bookmarks("add3").Range.Text = Me.add3
myWord.ActiveDocument.Bookmarks("add4").Range.Text = Me.add4
myWord.ActiveDocument.Bookmarks("designation").Range.Text = Me.desig
myWord.ActiveDocument.Bookmarks("grade").Range.Text = Me.grade
myWord.ActiveDocument.Bookmarks("location").Range.Text = Me.location
myWord.ActiveDocument.Bookmarks("reportingto").Range.Text = Me.reporting
'If Me.Adresse <> "" Then myWord.ActiveDocument.Bookmarks("adresse").Range.Text = Me.Adresse
.Visible = True
End With
***** following code giving runtime error 438 **
how to fix this error...its urgent help...

Aim of this prog, based on data i have entered using excel form word doc should shart and
copy all entered field to word bookmarks..
so that i can print my word offer letter

Set myWord = Nothing

On Error GoTo Err_Enveloppe_Click

Exit Sub

MsgBox Err.Description
Resume Exit_Enveloppe_Click

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums