Search code examples
ms-wordexchange-serverddegoldmine

Manipulate DDE using VBA?


I have a CRM application (GoldMine) that acts as a DDE Server and allows for pulling merge fields into Word documents using DDE like so:

{ DDE GOLDMINE DATA CONTACT2->UPREAWDAMT \* CHARFORMAT }

As you know, DDE does not pass along any formatting - and I'd like to use VBA to do some string manipulation on these fields, but I'm unsure how exactly to make this happen?

I know I can open a new DDE channel and all that and pull info. that way - but I particularly want to reuse the existing information - not open new channels?


Solution

  • I dont know about using VBA, but GoldMine supports dBASE expressions (like in Lookup.ini file) and you can use them in document templates to manipulate strings. For example:

    { IF { DDE GOLDMINE DATA &LEN(DTOS(CONTACT2->UPROLONG)) \* CHARFORMAT } > 0 { DDE GOLDMINE DATA WDATE(CONTACT2->UPROLONG,3) \* CHARFORMAT } { DDE GOLDMINE DATA '<<__>>\ ________\ '+SUBSTR(DTOS(DATE()),1,4) \* CHARFORMAT }}
    

    Where LEN([string]), DTOS([date]), WDATE([date], [format]), SUBSTR([string], [start], [length]), DATE() - dBASE functions