Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-31-2019, 02:11 AM
tamasig tamasig is offline Copying style from normal template into current documet Mac OS X Copying style from normal template into current documet Office 2016 for Mac
Novice
Copying style from normal template into current documet
 
Join Date: Dec 2019
Posts: 2
tamasig is on a distinguished road
Default Copying style from normal template into current documet

Dear All,

This may be a newbie question, but I cannot seem to figure out how to do this. I have a style in the global normal.dotm template, "Comment Text" that I would like to copy into the current document. When I use the following code, Word simply crashes, however:
Code:
Application.OrganizerCopy Source:= _
        NormalTemplate _
        , Destination:=ActiveDocument, Name:="Comment Text", Object:= _
        wdOrganizerObjectStyles
Any and all help would be highly appreciated.



Many thanks,
tamasig

Last edited by Charles Kenyon; 01-04-2020 at 12:40 PM. Reason: Change title to give better info about question and mark as solved
Reply With Quote
  #2  
Old 12-31-2019, 11:53 AM
jeffreybrown jeffreybrown is offline Copying style from normal template into current documet Windows 10 Copying style from normal template into current documet Office 2016
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

It looks like you are missing the path for the source.

I recorded a macro and it showed this.

Code:
Sub Macro1()
    Application.OrganizerCopy Source:="C:\Users\jeffb\AppData\Roaming\Microsoft\Templates\Normal.dotm", _
        Destination:=ActiveDocument, Name:="Comment Text", Object:=wdOrganizerObjectStyles
End Sub
Reply With Quote
  #3  
Old 01-01-2020, 02:57 AM
tamasig tamasig is offline Copying style from normal template into current documet Mac OS X Copying style from normal template into current documet Office 2016 for Mac
Novice
Copying style from normal template into current documet
 
Join Date: Dec 2019
Posts: 2
tamasig is on a distinguished road
Default

Thanks, @jeffreybrown. Because I wanted to write a code that is more general than specifying the actual path, I replaced the Source with NormalTemplate.FullName; however, even in that case Word crashed repeatedly. This kept happening until I also changed ActiveDocument to ActiveDocument.FullName.

The final code then is the following:

Code:
Application.OrganizerCopy Source:=NormalTemplate.FullName, Destination:=ActiveDocument.FullName, Name:="Comment Text", Object:=wdOrganizerObjectStyles
Many thanks,
tamasig
Reply With Quote
  #4  
Old 01-04-2020, 12:39 PM
Charles Kenyon Charles Kenyon is offline Copying style from normal template into current documet Windows 10 Copying style from normal template into current documet Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I changed the title of this to show copying from the normal template rather than from a global template (add-in).


Here is my page on transferring from a global template.
A Global StyleSheet in Microsoft Word?
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert old pres with template applied to the current version of PowerPoint with a new template dianahbr PowerPoint 0 02-21-2018 10:38 AM
Copying paragraphs from multiple documents to the current one. paik1002 Word VBA 3 02-22-2016 04:03 AM
Copying style from normal template into current documet What happens when I delete the Global template? jjmclell Project 2 05-10-2015 02:48 PM
Copying style from normal template into current documet A macro to reveal keyboard shortcuts assigned to global template? New Daddy Word 3 12-17-2013 07:08 AM
Copying style from normal template into current documet Global template ryalls3857 Word 1 12-27-2010 05:45 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:52 AM.


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