Write to a closed Word file???

R

Robert Crandal

Using macros in Word 2007, is it possible to write data
to a closed Word file (.doc)??? Just curious....

thank u
 
D

Doug Robbins - Word MVP

As a Word 2007 file can have its extension changed to .zip and then opened
to reveal a series of individual files, it is probably possible, but it is
not something that I would attempt.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
G

Graham Mayor

No, you'll need to open it, add to it, save it and close it. You can do all
that in vba without having to see the document.e.g.

Dim oDoc As Document
Dim strPath As String
strPath = "C:\Path\YourDocument.docx"
Set oDoc = Documents.Open(FileName:=strPath, Visible:=False)
oDoc.Range.InsertAfter "Stuff"
oDoc.Close wdSaveChanges

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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