SV: Excel automation by Anders
Anders
Mon Aug 22 02:12:33 CDT 2005
That will only work if the .Add method returns an object reference. Does it?
-Anders
Den 05-08-21 16.52, i artikeln Ofl25$lpFHA.3408@tk2msftngp13.phx.gbl, skrev
"Neil Waterworth" <spammonkey at microsocks.com>:
> Thanks Jan and Anders,
>
> I see your point. I'll try it with
>
> oPub = owb.PublishObjects.Add(........)
> with oPub
> ** do stuff
> endwith
>
> Still don't understand how it works fine in development. The code was
> originally adapted to VFP from a recorded VBA macro.
>
> Thanks, and I'll post back success or failure.
>
> Regards,
> Neil
>
> "Anders" <anders.altberg@telia.com> wrote in message
> news:BF2E1488.25AA%anders.altberg@telia.com...
>> There's a misuse of the WITH block:
>>
>> WITH owb.PublishObjects
>> .Add(xlSourceChart, lcWeekChart, "Chart1", "", ;
>> xlHtmlChart, "Weekly Sales", "")
>> ENDWITH
>> Or remove the WITH entirely and make the call a single line
>>
>> owb.PublishObjects ;
>> .Add(xlSourceChart, lcWeekChart, "Chart1", "", ;
>> xlHtmlChart, "Weekly Sales", "")
>>
>> -Anders
>>
>> Den 05-08-20 19.19, i artikeln #ewTPtapFHA.708@TK2MSFTNGP09.phx.gbl, skrev
>> "Neil Waterworth" <spammonkey at microsocks.com>:
>>
>>> I'm getting an "Unknown COM status error" on the second line of code
>>> below
>>> (owb is an Excel Workbook object). This works fine in the development
>>> environment, but not on the end user deployment. I'm guessing that VFP
>>> being
>>> installed might help. Does anyone know what I need to install to make
>>> this
>>> work? Briefly, the code populates a worksheet, creates a graph from it,
>>> saves the graph as HTML and displays it in a browser.
>>>
>>> lcWeekChart = sys(5) + curdir() + "graphs\" + sys(2015) + ".htm"
>>> with owb.PublishObjects.Add(xlSourceChart, lcWeekChart, "Chart1", "",
>>> xlHtmlChart, "Weekly Sales", "")
>>>
>>> AFAIK, the development and production environments are using the same
>>> Office
>>> 2003 install.
>>>
>>> Thanks for any help,
>>> Neil
>>>
>>>
>>
>
>