Re: Disable and enable a document in vba issue? by Jezebel
Jezebel
Tue Mar 13 22:30:17 CDT 2007
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
"Nick" <Nick@discussions.microsoft.com> wrote in message
news:A6140B5E-CB0F-4A5D-B01E-D93BAC0732D8@microsoft.com...
> 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