ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Word doc opens, but not in visible window? (https://www.excelbanter.com/excel-programming/281147-word-doc-opens-but-not-visible-window.html)

Ed[_9_]

Word doc opens, but not in visible window?
 
I use these lines
Doc = Fpath & "\" & Fname & ".doc"
Set WordDoc = Word.Documents.Open(Doc)
to open a Word doc so more code can copy a selection and paste it into my
workbook. I never see the doc in a visible window, but the information does
get copied and pasted, so I know it is getting the doc. Now, what do I need
to ad to see the doc? I tried Visible = , but my choices were xlVisible,
xlHidden, and xlVeryHidden, which don't apply to Word docs.

Ed



Ron de Bruin

Word doc opens, but not in visible window?
 

Try this Ed


Dim WD As Object
Dim doc As String
Doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ed" wrote in message ...
I use these lines
Doc = Fpath & "\" & Fname & ".doc"
Set WordDoc = Word.Documents.Open(Doc)
to open a Word doc so more code can copy a selection and paste it into my
workbook. I never see the doc in a visible window, but the information does
get copied and pasted, so I know it is getting the doc. Now, what do I need
to ad to see the doc? I tried Visible = , but my choices were xlVisible,
xlHidden, and xlVeryHidden, which don't apply to Word docs.

Ed





Ed[_9_]

Word doc opens, but not in visible window?
 
Beautiful, Ron! Thank you!

Ed

"Ron de Bruin" wrote in message
...

Try this Ed


Dim WD As Object
Dim doc As String
Doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ed" wrote in message

...
I use these lines
Doc = Fpath & "\" & Fname & ".doc"
Set WordDoc = Word.Documents.Open(Doc)
to open a Word doc so more code can copy a selection and paste it into

my
workbook. I never see the doc in a visible window, but the information

does
get copied and pasted, so I know it is getting the doc. Now, what do I

need
to ad to see the doc? I tried Visible = , but my choices were

xlVisible,
xlHidden, and xlVeryHidden, which don't apply to Word docs.

Ed








All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com