![]() |
#1
|
|||
|
|||
![]()
Greetings to all, I am trying to copy styles from a template only if that style is not present in Activedocument. I am using following code:
Code:
Function styleimporter(st1 As String, st2 As String) Dim i As Integer On Err.Number = 5834 GoTo exx Dim a() a = Array(st1, st2) For i = LBound(a) To UBound(a) On Error GoTo exx With ActiveDocument.Range.find .ClearFormatting .Replacement.ClearFormatting .Style = a(i) .Execute exx: If .Execute = False Then Application.OrganizerCopy _ Source:="C:\Users\aspKamal\AppData\Roaming\Microsoft\Templates\NecessaryStyles.dotm.docx", _ Destination:=ActiveDocument.FullName, _ name:=a(i), _ Object:=wdOrganizerObjectStyles End If End With Next End Function Thanks, Bikram |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importing styles using Templates | Bikram | Word VBA | 2 | 08-31-2021 10:40 PM |
Getting rid of Styles and Templates confusion | John 4 | Word | 1 | 10-27-2020 07:25 AM |
Using Styles in Templates to help format text - Importing and working with Templates | daithy | Word | 2 | 01-03-2020 05:06 PM |
![]() |
Red Pill | Word | 3 | 06-12-2012 06:19 AM |
![]() |
rbilleaud | Word | 4 | 06-29-2011 05:51 PM |