Cardbox > Forums > Macros and Programming > "Opening Word using a Macro in Cardbox"
Opening Word using a Macro in Cardbox
Posted By | Post |
---|---|
SHopkin | 19-May-2006 13:32 Since upgrading to version 3 we have had our macro re-written for opening a document in MS Word. Unfortunately we each use this macro 100 + times a day and it opens Word each time rather than just opening a Word document. Our technical person has tried & tried but without joy. Can anyone advise ? filen="H:\documents\cv\"& fields("CV")&".doc" ' The following 4 lines open the CV file using an existing copy of Word word.application.visible = true |
Paul Irvine | 19-May-2006 15:52 Try changing the GetObject line to set word=Getobject(,"Word.Application") You will probably have to use Windows SetWindowPos API to bring Word to the front. There is some useful information at http://www.codeproject.com/cs/miscctrl/winwordcontrol.asp?print=true about this. |
Alex Maines | 20-May-2006 08:36 The best approach is to use a little of both the solutions provided. ' First, try to find an existing copy of MSWord: ' If there isn't one, make one ' Bring Word to the front - No need to call any Windows API functions |
Charles Welling | 22-May-2006 07:49 Why don't you make the field clickable? From your macro I gather that all CV's are in H:\documents\cv\. Just give the field the caption "file://H:\documents\cv\". This feature was added in build 4217. Charles |
Martin Collis | 7-Dec-2007 16:35 Charles, tried your method which was also recommended by someone else. Looks like a perfect solution for us to open associated WORD documents that have their address completely specified within our cardbox record. |
Charles Welling | 10-Dec-2007 08:59 Martin, make sure that the database is opened in the "completely trusted" mode. Below the list of filenames that appears when you select File, Open is a box that specifies the safety level. Any level lower than completely trusted does not allow the opening of external files from a record. |