Page 1 of 1
Execute a DDE call in Base
Posted: Sun Aug 04, 2013 5:43 am
by doncell6
I have searched the forum and the Base pdf file, cannot find an answer to my question.
I am a LibreOffice novice.
How do I execute a dde call in Base? Perhaps someone has a snippet of code they might share?
Thank you.
Re: Execute a DDE call in Base
Posted: Sun Aug 04, 2013 9:56 am
by F3K Total
Hi,
in my opinion, it's not that simple, 'cause i couldn't find a way to use DDE via Starbasic without an OpenOffice-crash.
So i tried this way, which works:
- load a calc-doc
- containing the DDE-Link
- hidden mode
- from a BASE-document
- add a DDE-refresh listener ("com.sun.star.util.XRefreshListener") to the DDE-Link in the calc-doc
- refresh the link once by code, to activate it
- on _refreshed Event, insert a new row into the database
Find attached three files as a sample:
- DDE_Source.ods to simulate a DDE-Source
- DDE_Bridge.ods loaded in hidden mode, receiving the Values from DDE_Source.ods
- DDE_Target.odb the stearing file, DDE-values will be inserted into table DDE_RESULT
Before you can run it, you have to prepare:
- Open DDE_Source.ods
- select cell A1 on Sheet 1 and copy it to the clipboard.
- open DDE_Bridge.ods
- insert clipboard-content as DDE-Link to cell A1 of Sheet 1 of DDE_Bridge.ods to replace my current DDE-Link
- store both calc-docs
- close DDE_Bridge.ods
Now you can try and learn from the sample:
- be shure to have adjusted macro-security at least to middle, that you can run macros
- open DDE_Target.odb
- open Form DDE_RESULT
- change to DDE_Source.ods
- enter a new value into cell A1
- observe Form DDE_RESULT
Please let us know if this helped
R
Re: Execute a DDE call in Base
Posted: Mon Aug 05, 2013 5:32 am
by doncell6
Thank you very much for replying with lots of detail. I'll try this just as soon as possible. I am a novice LibreOffice user so I'm sure I'll have more questions.