AndrewMozley
Programmer
I would like to include a command button within a VFP application, so that the user can refer to a .doc file (just one per customer) which he can maintain in whatever way he likes, and can bring it up when he clicks on a button which I will add to the form.
I have Tamar’s helpful book ‘Microsoft Office Automation with Visual Foxpro’.
The filename will be ‘XtraCust’ + <Cust account> + '.doc'. So perhaps xtracustA003.doc It will be saved in a folder xtra within the user folder for the system.
When he clicks on the button I will check whether the file exists; otherwise I will fire up Word and open the document.
But this is some way in the future! At present I am trying to get Word to fire up at all (and be visible) from VFP. So as a first test I am trying to see if I can open an existing Word file. This is my code :
I had hoped that the first line would create a Word session and display it. It certainly does something. The hourglass icon is displayed for maybe 2-3 seconds. And when I look at the taskbar, there is a Microsoft Word session. But no new window appears on the screen.
When I execute the second, ‘Microsoft Word’ appears in the task window (with two subtasks, ‘Artificial Intelligence (AI) host’ and ‘File in use’).
And if I try to switch back to my VFP session, this window pops up.
Grateful for any suggestions - Andrew
I have Tamar’s helpful book ‘Microsoft Office Automation with Visual Foxpro’.
The filename will be ‘XtraCust’ + <Cust account> + '.doc'. So perhaps xtracustA003.doc It will be saved in a folder xtra within the user folder for the system.
When he clicks on the button I will check whether the file exists; otherwise I will fire up Word and open the document.
But this is some way in the future! At present I am trying to get Word to fire up at all (and be visible) from VFP. So as a first test I am trying to see if I can open an existing Word file. This is my code :
Code:
SET STEP ON
oWord = CREATEOBJECT("Word.application")
oword.documents.open("C:\Stage2\progress.doc")
I had hoped that the first line would create a Word session and display it. It certainly does something. The hourglass icon is displayed for maybe 2-3 seconds. And when I look at the taskbar, there is a Microsoft Word session. But no new window appears on the screen.
When I execute the second, ‘Microsoft Word’ appears in the task window (with two subtasks, ‘Artificial Intelligence (AI) host’ and ‘File in use’).
And if I try to switch back to my VFP session, this window pops up.
Grateful for any suggestions - Andrew