Static void OpenWordTemplate()
{
Dialog d;
DialogField dialogFilename;
COM wordApp;
COM wordDocuments;
FileName fileName;
wordApp = new COM("word.application");
wordDocuments = wordApp.Documents();
d = new Dialog();
d.caption("select a file");
dialogFilename = d.addField(extendedTypeStr(FilenameOpen),"File Name");//add a field where you select your file in a specific path
d.run();//execute dialog
if(d.closedOk())
{
filename = dialogFileName.value();//return path file value
}
try
{
wordDocuments.Open(fileName);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
wordApp.visible(true);
}
{
Dialog d;
DialogField dialogFilename;
COM wordApp;
COM wordDocuments;
FileName fileName;
wordApp = new COM("word.application");
wordDocuments = wordApp.Documents();
d = new Dialog();
d.caption("select a file");
dialogFilename = d.addField(extendedTypeStr(FilenameOpen),"File Name");//add a field where you select your file in a specific path
d.run();//execute dialog
if(d.closedOk())
{
filename = dialogFileName.value();//return path file value
}
try
{
wordDocuments.Open(fileName);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
wordApp.visible(true);
}
Happy DAX....
No comments:
Post a Comment