The information in this article applies to:
SYMPTOMSWhen you use the WordBasic command, CopyFile, the copy of the file does not have an extension. As a result, the copied file loses its association with Microsoft Word and becomes a generic Windows 95 file. The following code results in this problem:
CAUSEThis problem occurs when the "Hide MS-DOS file extensions for file types that are registered" is checked in Windows Explorer. (To locate this option, in Windows Explorer, click Options on the View menu.) STATUSMicrosoft has confirmed this to be a problem in Microsoft Word for Windows 95 version 7.0. This problem was corrected in Word version 7.0a for Windows 95. RESOLUTIONTo work around this problem, use one of the following methods to preserve the copied file's association with Microsoft Word. Method 1Make sure the "Hide MS-DOS file extensions for file types that are registered" option in Windows Explorer is not checked.Method 2Use the Declare command to make a CopyFileA call to Kernel32.dll. To do this, use the following macro:NOTE: The sample assumes that you have a Microsoft Word document called "Test.doc" located in the C:\Storage folder.
NOTE: Using a number greater than 0 in the above example will not
overwrite an existing file. The file specified as the destination
remains the same. However, if 0 is used, as in the example below,
the destination file will be overwritten by the specified file if
it exists in the specified directory.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT
YOUR OWN RISK. Microsoft provides this macro code "as is" without
warranty of any kind, either expressed or implied, including but not
limited to the implied warranties of merchantability and/or fitness
for a particular purpose.
MORE INFORMATIONAdditional query words: 7.0 word95 copyfile copy file wordbasic word7 winword word basic macro example 6.0 2.0 2.0a-cd
Keywords : kbmacroexample |
Last Reviewed: November 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |