Problem with visibility on Documents.Add

A

Aldo

Hi all

I'm working on a macro to create 10s of word documents and then pasting the
clipboard into then and save them

I would like to avoid the created windows to appear on the screen.

Is there any possibility to paste the clipboard and save on non visible and
non active documents ?

As i personally didn't find a solution, I tried to create the documents with
a reduced size with this code but when I create a non visible document I
cannot do anything on it, even make it visible as the .windows.count = 0 so
I cannot use the .windows(1).visible = true

Any idea ?

Documents.Add Template:="", NewTemplate:=False, DocumentType:=1,
Visible:=False

For I = 1 To Documents.Count
NN = Documents(I).Name
With Documents(I).Windows(1) ---> Error on non visible document
.Height = 100
.Width = 100
.Visible = True
.Activate
End With
Next

Thanks
 
H

Helmut Weber

Hi Aldo,
Is there any possibility to paste the clipboard and save
on non visible and non active documents ?

Doesn't seem a problem to me. Let's say there are two docs,
"Mydoc-01.doc" and "Mydoc-02.doc". And both have only 1 window.
Or am I missing something?


Sub test88888()
Dim oDoc1 As Document
Dim oDoc2 As Document

Set oDoc1 = Documents("Mydoc-01.doc")
Set oDoc2 = Documents("Mydoc-02.doc")

oDoc1.Windows(1).Visible = False
oDoc2.Windows(1).Visible = False

oDoc1.Range(0, 0).Paste
oDoc2.Range(10, 10).Paste

oDoc1.Windows(1).Visible = True
oDoc2.Windows(1).Visible = True
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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