DataEase » Support » Knowledge Base » DataEase 7.2 Articles » How to open a WORD document from a button in DataEase

First, create the following 2 CDFs:

1- Function Name: ShellExecuteA
CDF library name: SHELL32.DLL
Return type: Int
Create 6 Parameters:
1-Name: Hndwin Type: Int
2-Name: cAction Type: String
3-Name: cFileName Type: String
4-Name: cParams Type: String
5-Name: cDir Type: String
6-Name: nShowWin Type: Int

2- Function Name: IsFile
Description: Determines if a file exists CDF library name: OSFUNC.DLL Return type: String Create 2 Parameters:
1- Name: Path/File Name Type: String
2- Name: Attributes to Find Type: Int

You should then close and re-open your DataEase application (to register the CDFs).

You will then need to create a field “DocumentPath” with data-type text and length 100; and a button with caption “Open Document”.

Right-click the button and select OML from the pop-up menu and type the
following:

define “tTemp” number .

if IsFile(DocumentPath,00)= “false” then message “The file does not exist” window.
else
tTemp := ShellExecuteA(0,”open”,DocumentPath,”",”",1) .
end.