none
Determine if it's safe to write to a Word file (from Excel)? RRS feed

  • Question

  • I am using VBA for both Excel 2007 and Word 2007.   My Excel workbooks have VBA code which opens up some Word files, writes data, then finally closes that Word file.  So, basically, I'm using Excel to write data into Word files!

    The problem with the above scenario is, what if the target Word file is currently in use or "write locked" by another user?   I would like to add VBA code to my Excel workbook that should determine if the target Word file is safe to open and write into.   How should I do this? Should I merely test if the file is "open"??  Or, is it better to test if the Word file is currently "write locked"?  Do Word files even have such a property that I can check for while using Excel??

    Robert C.

     


    jmmc
    Monday, March 7, 2011 3:35 AM

Answers