Groups > Superbase > Superbase 3 programming > Re: Actually seems more simple




OLE command for the OpenFile dialog in Word

OLE command for the OpenFile dialog in Word
Fri, 02 Nov 2007 09:58:43 -070
I am trying to update an old app to the latest word releases and
am changing some of the DDE stuff that no longer works over to
OLE.  I can get most of it, but what I need is to open Word,
navigate to a directory, minimize Superbase, then invoke the 
OpenFile dialog within word.

I can do everything but the last OpenFile.  I have spent several
hours on this now and cannot find it in previous posts, nor can
I seem to get the syntax correct.

Any help is greatly appreciated.
Post Reply
Actually seems more simple
Mon, 05 Nov 2007 08:06:25 -080
I can get everyother command to work properly by looking at the code
generated by the macro recorder.  But no code is genereated to just
display the dialog.  When you actually select a file to open, I can
get that done, but I do not want a specific file, just the dialog
itself called to open so that the user can select the proper file.
When I open the dialog, then cancel it no VBA code is generated.  The
command copied from the AllCommands part that is linked to the button
on the toolbar does not work...

I just thought someone had been here before and could help.

Thanks







On Mon, 05 Nov 2007 12:29:45 +0000, Neil Robinson <neil@simpol.com>
wrote:

>tanos_8@hotmail.com wrote:
>> I am trying to update an old app to the latest word releases and
>> am changing some of the DDE stuff that no longer works over to
>> OLE.  I can get most of it, but what I need is to open Word,
>> navigate to a directory, minimize Superbase, then invoke the 
>> OpenFile dialog within word.
>> 
>> I can do everything but the last OpenFile.  I have spent several
>> hours on this now and cannot find it in previous posts, nor can
>> I seem to get the syntax correct.
>> 
>> Any help is greatly appreciated.
>> 
>If you have access to the full documentation from VBA, look at the
>declaration of the OpenFile OLE2 call. In general, you have to supply
>every parameter to the call when calling from Superbase.
>
Post Reply
Re: OLE command for the OpenFile dialog in Word
Mon, 05 Nov 2007 12:29:45 +000
tanos_8@hotmail.com wrote:
> I am trying to update an old app to the latest word releases and
> am changing some of the DDE stuff that no longer works over to
> OLE.  I can get most of it, but what I need is to open Word,
> navigate to a directory, minimize Superbase, then invoke the 
> OpenFile dialog within word.
> 
> I can do everything but the last OpenFile.  I have spent several
> hours on this now and cannot find it in previous posts, nor can
> I seem to get the syntax correct.
> 
> Any help is greatly appreciated.
> 
If you have access to the full documentation from VBA, look at the
declaration of the OpenFile OLE2 call. In general, you have to supply
every parameter to the call when calling from Superbase.

Post Reply
Re: Actually seems more simple
Mon, 05 Nov 2007 13:48:43 -050
This is interesting:

The VB code that works in Word is

Dialogs(wdDialogFileOpen).Show
or
Dialogs(wdDialogFileOpen).Display

So one would have thought that this should work:

DIM s AS object
SET s = CREATEOBJECT ("WORD.application")
s.Dialogs(wdDialogFileOpen).Show
or maybe
s.Dialogs("wdDialogFileOpen").Show
or maybe
DIM WordObj AS object
SET WordObj = s.Dialogs
WordObj("wdDialogFileOpen").Show

but these are not correct, nor other variations

So if you find answer, I hope you'll post here.

JDK


tanos_8@hotmail.com wrote:
> I can get everyother command to work properly by looking at the code
> generated by the macro recorder.  But no code is genereated to just
> display the dialog.  When you actually select a file to open, I can
> get that done, but I do not want a specific file, just the dialog
> itself called to open so that the user can select the proper file.
> When I open the dialog, then cancel it no VBA code is generated.  The
> command copied from the AllCommands part that is linked to the button
> on the toolbar does not work...
> 
> I just thought someone had been here before and could help.
> 
> Thanks
> 
> 
> On Mon, 05 Nov 2007 12:29:45 +0000, Neil Robinson <neil@simpol.com>
> wrote:
> 
>> tanos_8@hotmail.com wrote:
>>> I am trying to update an old app to the latest word releases and
>>> am changing some of the DDE stuff that no longer works over to
>>> OLE.  I can get most of it, but what I need is to open Word,
>>> navigate to a directory, minimize Superbase, then invoke the 
>>> OpenFile dialog within word.
>>>
>>> I can do everything but the last OpenFile.  I have spent several
>>> hours on this now and cannot find it in previous posts, nor can
>>> I seem to get the syntax correct.
>>>
>>> Any help is greatly appreciated.
>>>
>> If you have access to the full documentation from VBA, look at the
>> declaration of the OpenFile OLE2 call. In general, you have to supply
>> every parameter to the call when calling from Superbase.
>>
Post Reply
Re: Actually seems more simple
Mon, 05 Nov 2007 14:13:49 -050
  DIM s AS Object
  SET s = CREATEOBJECT ("WORD.application")
  s.Visible = - 1
  test$ = "*.doc"
  REQUEST @100,100"Pick a Word
Document","",26,buttonno%,test$
  s.Documents.Open(test$)

Does this in essence do want you want?

JDK






Kromkowski wrote:
> This is interesting:
> 
> The VB code that works in Word is
> 
> Dialogs(wdDialogFileOpen).Show
> or
> Dialogs(wdDialogFileOpen).Display
> 
> So one would have thought that this should work:
> 
> DIM s AS object
> SET s = CREATEOBJECT ("WORD.application")
> s.Dialogs(wdDialogFileOpen).Show
> or maybe
> s.Dialogs("wdDialogFileOpen").Show
> or maybe
> DIM WordObj AS object
> SET WordObj = s.Dialogs
> WordObj("wdDialogFileOpen").Show
> 
> but these are not correct, nor other variations
> 
> So if you find answer, I hope you'll post here.
> 
> JDK
> 
> 
> tanos_8@hotmail.com wrote:
>> I can get everyother command to work properly by looking at the code
>> generated by the macro recorder.  But no code is genereated to just
>> display the dialog.  When you actually select a file to open, I can
>> get that done, but I do not want a specific file, just the dialog
>> itself called to open so that the user can select the proper file.
>> When I open the dialog, then cancel it no VBA code is generated.  The
>> command copied from the AllCommands part that is linked to the button
>> on the toolbar does not work...
>>
>> I just thought someone had been here before and could help.
>>
>> Thanks
>>
>>
>> On Mon, 05 Nov 2007 12:29:45 +0000, Neil Robinson
<neil@simpol.com>
>> wrote:
>>
>>> tanos_8@hotmail.com wrote:
>>>> I am trying to update an old app to the latest word releases
and
>>>> am changing some of the DDE stuff that no longer works over to
>>>> OLE.  I can get most of it, but what I need is to open Word,
>>>> navigate to a directory, minimize Superbase, then invoke the 
>>>> OpenFile dialog within word.
>>>>
>>>> I can do everything but the last OpenFile.  I have spent
several
>>>> hours on this now and cannot find it in previous posts, nor
can
>>>> I seem to get the syntax correct.
>>>>
>>>> Any help is greatly appreciated.
>>>>
>>> If you have access to the full documentation from VBA, look at the
>>> declaration of the OpenFile OLE2 call. In general, you have to
supply
>>> every parameter to the call when calling from Superbase.
>>>
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact