Thread View: pl.comp.lang.vbasic
1 messages
1 total messages
Started by e... Ed Hassinger
Thu, 25 Sep 1997 00:00
"Simple" OLE Automation and Word Problem
Author: e... Ed Hassinger
Date: Thu, 25 Sep 1997 00:00
Date: Thu, 25 Sep 1997 00:00
59 lines
2963 bytes
2963 bytes
Well, for as praised as OLE automation is, it doesn't appear to do crap. I have a single form with a single
button with the following code attached to it.
Private Sub Command1_Click()
Dim oExcelFile As Object
Set oExcelFile = CreateObject("Word.Application")
With oExcelFile
.Documents.Open filename:="C:\win95\desktop\input\yes1.xls", ConfirmConversions:=False,
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:=""
End With
End Sub
The purpose of this application is to load an excel file into Word. Unfortunately, a small dialog with the
caption "Open Worksheet" appears. The default setting is for all of the Excel sheets, which is what I
want. However, there does not appear to be any way to hit "return" for this dialog. Therefore, a user
must hit enter every time the application is run. (This is bad)
This should seem possible to do. Taken verbatim from MS's lame VB help file. If you select the F2 to get
to the Object Browser, highlight "dialog" on the left, then hit F1 you will get the following help excerpts
listed below.
"The Dialogs collection contains all the built-in dialog boxes in Word."
"You can display a built-in dialog box to get user input or to control Word by using Visual Basic. "
" To access a particular built-in Word dialog box, you specify a WdWordDialog constant with the
Dialogs property."
According to this, piece of cake. However, I don't see any WdWordDialog for this "Open Worksheet"
dialog. The help file did say ALL of Word's dialogs. Why can't I reach this dialog to do something with
it? The sheet other available dialogs is about 7 pages long, but there is nothing close in description.
I've tried every other conceivable way to close this dialog. The "sendkeys" function does not work.
Apparently with some kind of DDE and OLE conflict. Recording a word macro gives me the VB code
above. However, Word does not include whatever code would be necessary to hit "return" for this
dialog. Real smart. I thought part of the purpose of recording a macro would record your keystrokes.
Apparently not.
I can't use go about this problem with Excel. And to make sure of any conflicts I have unchecked "ignore
other applications" under TOOLS-OPTIONS-GENERAL (in Excel).
I guess I could go to MS's web page, but that would be like finding a needle in a haystack. Any advice
would be greatly appreciated. Please email directly. Thanks.
Ed Hassinger
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads