Skip to content

OLE & DDE

Forums Forums SIMPOL Programming OLE & DDE

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183
    Ian Macpherson
    Participant

    Hello to all First time writing but read all the threads posted. Neil suggested I get on the forum & try & find somebody competent in OLE & DDE I am converting a lawyers office application ( diary, case file handling, invoicing, etc etc plus automatic filling of Law Court documents with personal info from the database ( names, addresses, birth dates social security numbers etc etc In Sb30 I used a combinaition of OLE & DDE because I never got to work out how to send info to a bookmark with OLE but it worked fine with DDEPOKE DDETERM 5:DDETERM 6:DIM wo AS Object SET wo = CREATEOBJECT (“word.application”) wo.Visible = – 1 wordfile$ = “c:sb30cabinetaaa.doc” wo.Documents.Open(wordfile$) DDEINIT 5,”WinWord”,wordfile$ DIM o AS Object SET o = wo.ActiveDocument.Bookmarks IF o.Exists(“NomCli”) THEN ////(This gives -1 therefore OK) DDEPOKE 5,”NomCli”,”Monsieur ” + PRENOM.CLIENTS + ” ” + NOM_CLIENT.CLIENTS DDEPOKE 5,”Cher”,”Cher Monsieur,” followed by others to fill all the bookmarks then wo.ActiveDocument.Fields.Update() rem dest$ defined here hamac$ = dest$ + NomDoc$ + “.doc” wo.ActiveDocument.SaveAs(hamac$) //save the document in the case file folder DDEINIT 6,”Winword”,hamac$ wo.ChangeFileOpenDirectory(dest$) wo.Selection.WholeStory() wo.Selection.Font.Name = “Times New Roman” wo.Selection.Font.Size = 12 wo.Selection.HomeKey() Just an example. It all worked fine but I never got to understand why IF o.exists(NomCli) gave -1 I couldn’t sent it the info. If somebody has been there already a helping hand would be appreiciated. Now to SIMPOL for anybody going this way function main() string s wxautomation1 wo, wordfile string filename integer e e = 0 wo =@ wxautomation1.new(createinstance=”word.application”, error=e) if wo =@= .nul s = “Error number ” + .tostr(e, 10) + ” creating new Word instance{d}{a}” else wo.putproperty(property=”Visible”, error=e, – 1); // Make Word Visible wordfile =@ wo.getobject(property = “Documents”, error=e) if wordfile =@= .nul s = “Error number ” + .tostr(e, 10) + ” retrieving the Documents property object{d}{a}” else filename = “c:sb30bresdinaaa2.doc” wordfile.callmethod(method=”Add”, error=e, filename) if e != 0 and e != 531 else e = 0 //wo.putproperty(property=”ActiveDocument.Bookmarks.NomCli”, error=e, “Monsieur XXX”) wo.callmethod(method=”ActiveDocument.Fields.Update”, error=e) wo.callmethod(method=”Selection.WholeStory”, error=e) s = “Arial Narrow” wo.callmethod(method=”Selection.Font.Name = s”, error=e) wo.callmethod(method=”Selection.Font.Size = 14″, error=e) wo.callmethod(method=”Selection.HomeKey”, error=e) wo.callmethod(method=”ActiveDocument.PrintOut”, error=e) wo.callmethod(method=”close”, error=e) wo.callmethod(method= “quit”, error=e) The code opens Word fine & loads the document. The code to give info to the bookmark doesn’t work but that doesn’t surprise me. The callmethod to Fields.Update I’m not sure about ( as the Bookmarks don’t work yet) but the Selection.WholeStory, the ActiveDocument.PrintOut, the HomeKey, the close & the quit all work. The Selection.Font.Name & Size I’m still trying things out I get the impression the info is being sent because the toolbar info on the Font & size disappears but the document is not getting refreshed. This may help somebody else but I’m hoping somebody out there might be bale to help me with the Bookmarks thing. Thanks in advance ian Macpherson ( PS I’m English but I live in France)

    #1586
    Jim Locker
    Member
    #1585
    JD Kromkowski
    Participant

    My office uses WordPerfect, so i'm not much help on the Word.

    At a certain point where WP got to be 32-bit, DDE from SB to WP stopped
    working, so I was primarily using WP to DDE stuff into SB.
    i.e creating a record that would put a particular document in
    relationship to a particular claim.

    Obviously, that is not going to work until DDE to Simpol is available.
    (Which I have a feeling is going to be never.)

    It just got easier to use SB to export an ascii file of the case data I
    wanted to use and then have WordPerfect macros to access the ascii file
    (.dat file) and merge with form file (.frm). In theory, I could have
    used ODBC if I had ever bothered to move from SB2 to SB3.

    My plan with SIMPOL is to export the data I need, the use OpenShell to
    simply run the macros I've written in WordPerfect. In other word, I put
    the real code in WP rather than in Simpol.

    If I was going to use Word, I'd start here:

    http://msdn.microsoft.com/en-us/library/office/aa537149(v=office.11).aspx

    JDK

    On 03/05/13 5:19 AM, Ian Macpherson wrote:
    > Hello to all First time writing but read all the threads posted. Neil
    > suggested I get on the forum & try & find somebody competent in OLE & DDE
    > I am converting a lawyers office application ( diary, case file handling,
    > invoicing, etc etc plus automatic filling of Law Court documents with
    > personal info from the database ( names, addresses, birth dates social
    > security numbers etc etc
    > In Sb30 I used a combinaition of OLE & DDE because I never got to work out
    > how to send info to a bookmark with OLE but it worked fine with DDEPOKE
    > DDETERM 5:DDETERM 6:DIM wo AS Object
    > SET wo = CREATEOBJECT ("word.application")
    > wo.Visible = – 1
    > wordfile$ = "c:sb30cabinetaaa.doc"
    > wo.Documents.Open(wordfile$)
    > DDEINIT 5,"WinWord",wordfile$
    > DIM o AS Object
    > SET o = wo.ActiveDocument.Bookmarks
    > IF o.Exists("NomCli") THEN ////(This gives -1 therefore OK)
    > DDEPOKE 5,"NomCli","Monsieur " + PRENOM.CLIENTS + " " + NOM_CLIENT.CLIENTS
    > DDEPOKE 5,"Cher","Cher Monsieur,"
    > followed by others to fill all the bookmarks then
    > wo.ActiveDocument.Fields.Update()
    > rem dest$ defined here
    > hamac$ = dest$ + NomDoc$ + ".doc"
    > wo.ActiveDocument.SaveAs(hamac$) //save the document in the case file
    > folder
    > DDEINIT 6,"Winword",hamac$
    > wo.ChangeFileOpenDirectory(dest$)
    > wo.Selection.WholeStory()
    > wo.Selection.Font.Name = "Times New Roman"
    > wo.Selection.Font.Size = 12
    > wo.Selection.HomeKey()
    > Just an example. It all worked fine but I never got to understand why IF
    > o.exists(NomCli) gave -1 I couldn't sent it the info. If somebody has been
    > there already a helping hand would be appreiciated.
    > Now to SIMPOL for anybody going this way
    >
    > function main()
    > string s
    > wxautomation1 wo, wordfile
    > string filename
    > integer e
    >
    > e = 0
    > wo =@ wxautomation1.new(createinstance="word.application", error=e)
    > if wo =@= .nul
    > s = "Error number " + .tostr(e, 10) + " creating new Word
    > instance{d}{a}"
    > else
    > wo.putproperty(property="Visible", error=e, – 1); // Make Word Visible
    > wordfile =@ wo.getobject(property = "Documents", error=e)
    > if wordfile =@= .nul
    > s = "Error number " + .tostr(e, 10) + " retrieving the Documents
    > property object{d}{a}"
    > else
    > filename = "c:sb30bresdinaaa2.doc"
    > wordfile.callmethod(method="Add", error=e, filename)
    > if e != 0 and e != 531
    > else
    > e = 0
    > //wo.putproperty(property="ActiveDocument.Bookmarks.NomCli",
    > error=e, "Monsieur XXX")
    > wo.callmethod(method="ActiveDocument.Fields.Update", error=e)
    > wo.callmethod(method="Selection.WholeStory", error=e)
    > s = "Arial Narrow"
    > wo.callmethod(method="Selection.Font.Name = s", error=e)
    > wo.callmethod(method="Selection.Font.Size = 14", error=e)
    > wo.callmethod(method="Selection.HomeKey", error=e)
    > wo.callmethod(method="ActiveDocument.PrintOut", error=e)
    > wo.callmethod(method="close", error=e)
    > wo.callmethod(method= "quit", error=e)
    >
    > The code opens Word fine & loads the document. The code to give info to
    > the bookmark doesn't work but that doesn't surprise me. The callmethod to
    > Fields.Update I'm not sure about ( as the Bookmarks don't work yet) but
    > the Selection.WholeStory, the ActiveDocument.PrintOut, the HomeKey, the
    > close & the quit all work. The Selection.Font.Name & Size I'm still trying
    > things out I get the impression the info is being sent because the
    > toolbar info on the Font & size disappears but the document is not getting
    > refreshed.
    > This may help somebody else but I'm hoping somebody out there might be
    > bale to help me with the Bookmarks thing. Thanks in advance
    > ian Macpherson ( PS I'm English but I live in France)
    >
    >

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.