ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel-Opening Word (https://www.excelbanter.com/excel-programming/293906-excel-opening-word.html)

AW

Excel-Opening Word
 
Hope someone can assist. I have an excel template which when accessed,
opens a workbook. A button in this work book(cmdCCA) is then supposed to
access a Word Template and open a doument into which I wish to place some
cell values from the work book via a Word UserForm.

The code below is fine apart from ".visible=True", The userform in the Word
Document is shown, however when trying to proceed, the code falls over a
this point, and the Word Document does not show.

BUT if running from an .xls and not an .xlt, it will work.

I'd appreciate any guidance

Al@n


Private Sub cmdCCA_Click()
Dim appWD As Object
Dim MyDoc As Object

Set appWD = CreateObject("Word.Application")

With appWD

Set MyDoc = .documents.Add(Template:= _
"C:\Documents and Settings\Alan\Desktop\Test1\CCS1.dot", _
NewTemplate:=False, DocumentType:=0)

MyDoc.Activate

..visble = True

End With
End Sub




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

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