Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 07-25-2018, 11:28 AM
AnnaNmty AnnaNmty is offline OrganizerCopy method for ActiveDocument Windows 7 64bit OrganizerCopy method for ActiveDocument Office 2010 64bit
Novice
OrganizerCopy method for ActiveDocument
 
Join Date: Jul 2018
Posts: 2
AnnaNmty is on a distinguished road
Default

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.
Reply With Quote
 

Tags
active document, styles



Similar Threads
Thread Thread Starter Forum Replies Last Post
OrganizerCopy method for ActiveDocument Loop through listboxes in Application.OrganizerCopy Marrick13 Word VBA 50 04-16-2024 01:21 PM
ActiveDocument.ContentControls(ID) not working Tejas.T Word VBA 3 03-09-2015 06:50 PM
Loop through listboxes in Application.OrganizerCopy-revisited Marrick13 Word VBA 0 12-06-2014 06:07 AM
wordapp.ActiveDocument.SaveAs Not Working KSReynolds Mail Merge 1 07-18-2014 04:03 PM
OrganizerCopy method for ActiveDocument Using With ActiveDocument.Tables() SuzeG Word VBA 1 01-08-2014 02:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft