Why does this code work as a sub on a label but won't work as a module (1 Viewer)

M

Mike375

Guest
As a module with Public Function called in either a macro or another block of code the highlighted line comes up bit it works perfectly from behind a label.

Object required and Error 424

Dim Word_Obj As Object
Forms![Form1]!MyOle.Verb = -2
Forms![Form1]!MyOle.Action = 7
Set Word_Obj = MyOle.Object.Application.WordBasic
Word_Obj.ViewNormal

Word_Obj.FileSaveAs ("c:\Letters\BD.doc")
Call QW
 

khawar

AWF VIP
Local time
Tomorrow, 00:20
Joined
Oct 28, 2006
Messages
870
Set Word_Obj = MyOle.Object.Application.WordBasic

Replace it with

Code:
Set Word_Obj = Forms![Form1]!MyOle.Object.Application.WordBasic
 

khawar

AWF VIP
Local time
Tomorrow, 00:20
Joined
Oct 28, 2006
Messages
870
Set Word_Obj = MyOle.Object.Application.WordBasic

Replace it with

Code:
Set Word_Obj = Forms![Form1]!MyOle.Object.Application.WordBasic
 

Users who are viewing this thread

Top Bottom