ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting Word to work with Excel (https://www.excelbanter.com/excel-programming/363545-getting-word-work-excel.html)

[email protected]

Getting Word to work with Excel
 
Hi all,
I'm trying to use VBA to coordinate Word and Excel. I know that to
do so, you need to configure something under Tools-References.
Unfortunately, when I look under the Tools menu, References is grayed
out--does anyone know why this might be, and what I'd have to do to
enable it?

Thanks,
Mike


[email protected]

Getting Word to work with Excel
 
Oops, sorry for the double-post...anyway, if it helps, I'm using
Microsoft Office Word/Excel SP2, with Visual Basic 6.3.

wrote:
Hi all,
I'm trying to use VBA to coordinate Word and Excel. I know that to
do so, you need to configure something under Tools-References.
Unfortunately, when I look under the Tools menu, References is grayed
out--does anyone know why this might be, and what I'd have to do to
enable it?

Thanks,
Mike



[email protected]

Getting Word to work with Excel
 
It would be greyed out if you were stepping through the macro?

However, you shouldn't need to add the reference - just use the
following code


Dim appwd As Object
On Error GoTo notloaded
Set appwd = GetObject(, "Word.Application")
notloaded:
If Err.Number = 429 Then
Set appwd = CreateObject("Word.Application")
'if not adding a new document in your process, add it now
as this
'method would give an instance of Word WITHOUT a doc!
End If
appwd.Visible = True
On Error GoTo 0
With appwd
'do what you want
end with

wrote:
Oops, sorry for the double-post...anyway, if it helps, I'm using
Microsoft Office Word/Excel SP2, with Visual Basic 6.3.

wrote:
Hi all,
I'm trying to use VBA to coordinate Word and Excel. I know that to
do so, you need to configure something under Tools-References.
Unfortunately, when I look under the Tools menu, References is grayed
out--does anyone know why this might be, and what I'd have to do to
enable it?

Thanks,
Mike



Tom Ogilvy

Getting Word to work with Excel
 
Do you have a workbook open and it is the activeproject. References are
particular to a workbook - not the excel application.

--
Regards,
Tom Ogilvy


" wrote:

Hi all,
I'm trying to use VBA to coordinate Word and Excel. I know that to
do so, you need to configure something under Tools-References.
Unfortunately, when I look under the Tools menu, References is grayed
out--does anyone know why this might be, and what I'd have to do to
enable it?

Thanks,
Mike




All times are GMT +1. The time now is 05:10 PM.

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