Disable and enable a document in vba issue?

N

Nick

Hi All,

I have a word template1 , and i write documents.add("path template2", false,
wdNewBlankDocument, false) code to create another document base on template 2
with visiable = false, achieve this by set the last parameter of
document.add() to false.

the questiosn here is how to reset the visible of new docuemnt to true.

Cheers

Nick
 
J

Jezebel

Each document has a Windows collection. Visibility applies to the window,
rather than the document. To show/hide the document, set
[Document].Windows(1).Visible = True/false. So you need a reference to the
document object, either retained from when you created it, or using the
Documents collection -- the last-opened document is Documents(1).


Dim pDoc as Word.Document

Set pDoc = Documents.Add(Template:="...", Visible:=FALSE)
:
pDoc.Windows(1).Visible = TRUE
 
Top