Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VBA to talk to VFP
Message
From
13/04/2004 03:58:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
12/04/2004 15:37:56
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00894203
Message ID:
00894335
Views:
6
>Has anyone done that:
>I am creating word doc in Visual FoxPro and let the user view/modify them. But I need to know (in Visual FoxPro) when the user actually modfied the doc)
>I am thinking of creating a semophore file like MyDocName.sem which if present Visual FoxPro can use to know the doc has been modified and then delete. I have never attempted VBA, however.
>
>Any help would be apreciated..
>
>Thanks
>
>
>Peter
>Peter Cortiel

Peter,
Using winAPI you might do that more precisely. However here is a rough sample with EventHandler() and VBA :
lcGetFile = Getfile('DOC')
oWordEvents=Newobject("WordEvents")

Local owrd As 'word.application'
owrd = Newobject('word.application')
Eventhandler(owrd,oWordEvents)
owrd.Documents.Open(lcGetFile)
owrd.Visible = .T.
owrd.Activate


DEFINE CLASS WordEvents AS session OLEPUBLIC
	IMPLEMENTS ApplicationEvents2 IN "C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE10\MSWORD.OLB"

	PROCEDURE ApplicationEvents2_Quit() AS VOID
	ENDPROC

	PROCEDURE ApplicationEvents2_DocumentChange() AS VOID
	ENDPROC

	PROCEDURE ApplicationEvents2_DocumentOpen(Doc AS VARIANT) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_DocumentBeforeClose(Doc AS VARIANT, Cancel AS LOGICAL) AS VOID
	If !doc.Saved
		? 'Doc has changed '+Ttoc(Datetime())
	EndIf
	ENDPROC
	PROCEDURE ApplicationEvents2_DocumentBeforePrint(Doc AS VARIANT, Cancel AS LOGICAL) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_DocumentBeforeSave(Doc AS VARIANT, SaveAsUI AS LOGICAL, Cancel AS LOGICAL) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_NewDocument(Doc AS VARIANT) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_WindowActivate(Doc AS VARIANT, Wn AS VARIANT) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_WindowDeactivate(Doc AS VARIANT, Wn AS VARIANT) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_WindowSelectionChange(Sel AS VARIANT) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_WindowBeforeRightClick(Sel AS VARIANT, Cancel AS LOGICAL) AS VOID
	ENDPROC
	PROCEDURE ApplicationEvents2_WindowBeforeDoubleClick(Sel AS VARIANT, Cancel AS LOGICAL) AS VOID
	ENDPROC
EndDefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform