Hi,

I have an Excel file that I'm displaying in a VFP form using an OLE control,
linking it to a local file.

Problem is, sometimes that local file gets locked up, and I can't overwrite
it with new data in order to display it in my form. Either the user has it
open in Excel, or in some cases, just having Excel open locks it up (can't
figure that one out...)

I would like to be able to dynamically change the file name that I'm
displaying, so that I can control it from within the program and not have it
hard-coded. But the OLE control's DocumentFile property is read-only at run
time.

Any ideas on this? Am I using the control wrong, or the wrong control?

Thanks,
Cathy

Re: Change file reference on OLE object by Gregory

Gregory
Thu Aug 17 12:06:53 CDT 2006


Cathy,

Not tested. Digging up old code

If (1) doesn't do the job, try (2)

(1)
=obj.workbooks(1).SaveAs(NewDocumentPath)

(2)
=obj.workbooks(1).SaveAs(NewDocumentPath)
=obj.workbooks(1).Close()
=obj.workbooks.Open(NewDocumentPath)

Gregory
__________

"Cathy Neppel" <Cathy Neppel@discussions.microsoft.com> wrote in message
news:F9D1959E-7FAD-486C-9107-0604C2F67C06@microsoft.com...
> Hi,
>
> I have an Excel file that I'm displaying in a VFP form using an OLE
> control,
> linking it to a local file.
>
> Problem is, sometimes that local file gets locked up, and I can't
> overwrite
> it with new data in order to display it in my form. Either the user has
> it
> open in Excel, or in some cases, just having Excel open locks it up (can't
> figure that one out...)
>
> I would like to be able to dynamically change the file name that I'm
> displaying, so that I can control it from within the program and not have
> it
> hard-coded. But the OLE control's DocumentFile property is read-only at
> run
> time.
>
> Any ideas on this? Am I using the control wrong, or the wrong control?
>
> Thanks,
> Cathy


Re: Change file reference on OLE object by CathyNeppel

CathyNeppel
Thu Aug 17 12:18:02 CDT 2006

Gregory,

Good thought, but it's not interfacing with Excel that is the problem. It's
getting the OLEControl object to now look at "NewDocumentPath" rather than
the original one, so that it displays the proper worksheet in the form.

Cathy

"Gregory Adam" wrote:

>
> Cathy,
>
> Not tested. Digging up old code
>
> If (1) doesn't do the job, try (2)
>
> (1)
> =obj.workbooks(1).SaveAs(NewDocumentPath)
>
> (2)
> =obj.workbooks(1).SaveAs(NewDocumentPath)
> =obj.workbooks(1).Close()
> =obj.workbooks.Open(NewDocumentPath)
>
> Gregory
> __________
>
> "Cathy Neppel" <Cathy Neppel@discussions.microsoft.com> wrote in message
> news:F9D1959E-7FAD-486C-9107-0604C2F67C06@microsoft.com...
> > Hi,
> >
> > I have an Excel file that I'm displaying in a VFP form using an OLE
> > control,
> > linking it to a local file.
> >
> > Problem is, sometimes that local file gets locked up, and I can't
> > overwrite
> > it with new data in order to display it in my form. Either the user has
> > it
> > open in Excel, or in some cases, just having Excel open locks it up (can't
> > figure that one out...)
> >
> > I would like to be able to dynamically change the file name that I'm
> > displaying, so that I can control it from within the program and not have
> > it
> > hard-coded. But the OLE control's DocumentFile property is read-only at
> > run
> > time.
> >
> > Any ideas on this? Am I using the control wrong, or the wrong control?
> >
> > Thanks,
> > Cathy
>
>

Re: Change file reference on OLE object by Gregory

Gregory
Thu Aug 17 13:35:17 CDT 2006

Cathy,

Then I have no answer to your problem, sorry

Gregory
__
"Cathy Neppel" <CathyNeppel@discussions.microsoft.com> wrote in message
news:BD63A883-5D5F-41C0-B82F-69E01D1F3DAC@microsoft.com...
> Gregory,
>
> Good thought, but it's not interfacing with Excel that is the problem.
> It's
> getting the OLEControl object to now look at "NewDocumentPath" rather than
> the original one, so that it displays the proper worksheet in the form.
>
> Cathy
>
> "Gregory Adam" wrote:
>
>>
>> Cathy,
>>
>> Not tested. Digging up old code
>>
>> If (1) doesn't do the job, try (2)
>>
>> (1)
>> =obj.workbooks(1).SaveAs(NewDocumentPath)
>>
>> (2)
>> =obj.workbooks(1).SaveAs(NewDocumentPath)
>> =obj.workbooks(1).Close()
>> =obj.workbooks.Open(NewDocumentPath)
>>
>> Gregory
>> __________
>>
>> "Cathy Neppel" <Cathy Neppel@discussions.microsoft.com> wrote in message
>> news:F9D1959E-7FAD-486C-9107-0604C2F67C06@microsoft.com...
>> > Hi,
>> >
>> > I have an Excel file that I'm displaying in a VFP form using an OLE
>> > control,
>> > linking it to a local file.
>> >
>> > Problem is, sometimes that local file gets locked up, and I can't
>> > overwrite
>> > it with new data in order to display it in my form. Either the user
>> > has
>> > it
>> > open in Excel, or in some cases, just having Excel open locks it up
>> > (can't
>> > figure that one out...)
>> >
>> > I would like to be able to dynamically change the file name that I'm
>> > displaying, so that I can control it from within the program and not
>> > have
>> > it
>> > hard-coded. But the OLE control's DocumentFile property is read-only
>> > at
>> > run
>> > time.
>> >
>> > Any ideas on this? Am I using the control wrong, or the wrong control?
>> >
>> > Thanks,
>> > Cathy
>>
>>