Discussion Locked

urgent help from VBA Expert

0 helpful
0 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

'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
myWord.Activate
'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 ..my word doc should shart and
copy all entered field to word bookmarks..
so that i can print my word offer letter

DoEvents
Set myWord = Nothing

On Error GoTo Err_Enveloppe_Click

Exit_Enveloppe_Click:
Exit Sub

Err_Enveloppe_Click:
MsgBox Err.Description
Resume Exit_Enveloppe_Click

0 replies

No replies were posted before this discussion closed.

This discussion is closed to new replies.