Macro in Styles Change for Importing

K

Krumrei

I need to be able to import a style within from my C:\ drive location to the
active document.

However, since this macro is going to be run on several different documents
with several different locations, I cannot simply code the Macro to look at a
specific locaiton. I have to allow the macro to put the new style into the
ActiveDocument that is open at the time, no matter what the locaiton is.

Here is the code that I started, but not sure how to apply it to the openly
active document? The Destination of C:\Documents and
Settings\20336453\Desktop\Comm.doc needs to be just the open document.




Application.OrganizerCopy Source:= _
"C:\cr147\Microsoft_Word_ACSSC_Styles_Template.dot", Destination:= _
"C:\Documents and Settings\20336453\Desktop\Comm.doc", Name:= _
"Indent 3_ACS", Object:=wdOrganizerObjectStyles
 
G

Graham Mayor

Application.OrganizerCopy Source:= _
"C:\cr147\Microsoft_Word_ACSSC_Styles_Template.dot", _
Destination:= ActiveDocument, Name:= _
"Indent 3_ACS", Object:=wdOrganizerObjectStyles


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Krumrei

That does not work.


P




Graham Mayor said:
Application.OrganizerCopy Source:= _
"C:\cr147\Microsoft_Word_ACSSC_Styles_Template.dot", _
Destination:= ActiveDocument, Name:= _
"Indent 3_ACS", Object:=wdOrganizerObjectStyles


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

It does if the document has not been saved, however

Dim fFname As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
fFname = .FullName
End With

Application.OrganizerCopy Source:= _
"C:\cr147\Microsoft_Word_ACSSC_Styles_Template.dot", _
Destination:=fFname, _
name:="Indent 3_ACS", _
Object:=wdOrganizerObjectStyles

will work when the document has been saved and will first force a save if
not.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top