Quote:
How you open the myFile document is irrelevant UNLESS you have created a new document...
|
But somehow it is relevant. I was testing with a file called Test2.docx (myFile). I created this document, along with the file styles are to be copied from. Neither is Read Only, has any restrictions, or could be open by other users. All styles that will be copied are available in the source document, Example.docx.
If I open myFile via File > Open from Word, the macro executes properly when I run it and the style copies correctly.
If I open myFile by double-clicking on it, the macro will not execute. If the file is opened from the network, the "File in Use" window pops up. Tested today: If the file is opened from my desktop, there is no error message, but no style is copied.
Quote:
OrganizerCopy expects the Source and the Destination to both be of type string. You supplied one string and one document so that would be a likely point of failure.
|
I did see that when finding the method originally in the MSDN, but admit to being a novice needing to learn more. This initial stab at writing the code worked with one method of opening though, and I am trying to understand why.
Quote:
If you choose to do this manually, style by style that is your prerogative but it can be done with a single line if you used an attached template...
|
There is a corporate restriction on attaching a template. In the end, my goal is to add/modify about 5 - 10 styles, depending upon project requirements. The DocSource would change in the future, but the macro would only be run on a currently open document.