Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memo => Word => Memo
Message
From
30/06/2003 15:21:51
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
30/06/2003 12:32:47
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00805363
Message ID:
00805435
Views:
29
>Is it possible to export a memo field to MS Word, work with the text an later save it back to the memo field ? How to do this? Thanks

Yes - first, you'll need a property to hold the object, and somewhere in the form's init
	This.oword= Createobject("Word.Application")
Then, in the button (same parent as your editbox)
Lparameters oMemo, cFilename
** parameters are the editbox object and a filename to keep a copy
** filename is not really necessary.
lcObject=Sys(1272, oMemo)
lcObject=Strtran(lcObject, Getwordnum(lcObject, 1, "."), "thisform")
This.cobjectforword=lcObject
_Cliptext=""
_Cliptext=oMemo.Value
This.cdocfilename=Fullpath(cFilename)
	With This.oword
		.documents.Add.Content.Paste
** this is just the special needs of my app - set language to English (US)
		.documents.Item(1).Content.Select
		.Selection.LanguageID = 1033
		.Selection.NoProofing = .F.
		.Application.CheckLanguage = .F.
** end special
		.documents.Item(1).SaveAs(This.cdocfilename)
		.Visible=.T.
	Endwith
Messagebox("Now Alt-tab to bring up Word. Return here and click OK when finished with Word (don't close it)")
Now in form.activate, you need to catch it when returning from Word:
If Type("this.oword.documents")="O" and;
	this.oword.documents.count>0 and ;
	Not Empty(This.cdocfilename) And Not type(This.cobjectforword)="O"
	With This.oword
		With .documents.Item(1)
			.content.select()
			.content.Copy()
			.Save()
		Endwith
		.documents.Close
		.Visible=.F.
	Endwith
	Local oEditbox
	oEditbox=Evaluate(This.cobjectforword)
	oEditbox.value=_cliptext
	oEditbox.SetFocus()
	Store "" To This.cdocfilename, This.cobjectforword
Endif
Works for me.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform