ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why this don't work (https://www.excelbanter.com/excel-programming/310905-why-dont-work.html)

Fernando Ortiz

Why this don't work
 
Hi Excel Experts:

Why this code don`t work, I already create a reference to the Word type
library

Sub WordControl()
Dim appWd As Word.Application
'line of error
Set appWd = Application.ActivateMicrosoftApp xlMicrosoftWord
...More lines of code
appWd.Quit
End Sub

Win XP pro, Excel 2002

Thanks for any advice

Regards

Fernando Ortiz





Chip Pearson

Why this don't work
 
ActivateMicrosoftApp does not return a reference to the activated
application. Instead, use GetObject.

Set appWd = GetObject(,"Word.Application")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Fernando Ortiz" wrote in message
...
Hi Excel Experts:

Why this code don`t work, I already create a reference to the
Word type
library

Sub WordControl()
Dim appWd As Word.Application
'line of error
Set appWd = Application.ActivateMicrosoftApp xlMicrosoftWord
...More lines of code
appWd.Quit
End Sub

Win XP pro, Excel 2002

Thanks for any advice

Regards

Fernando Ortiz








All times are GMT +1. The time now is 12:39 PM.

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