SBP ' ************************************************************************* ' * Report1() - Perform a mail merge on the specified document. Without ' * using the Superbase MailMerge() internal procedure. ' * ' ************************************************************************* VIEWLETT: LETTERTITLE$TITLE.LETTER "c:\SB4W\CAPSUGEL" "PERSONNL" "COMPANY" FILE "PARA" "LETTER" DDETERM makes sure all DDE channels are closed. 5 6 7 CHECKPRINT$"" ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\*.doc" "SELECT A WORD FILE FROM THE LIST PROVIDED","",18,A%,wordfile$ Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks. Notice the LEFT$(firstname.GSFSIMEM,1) is a calculation for the first initial of he FIRST - name. "PERSONNL" ~ ` OB("PERSONNL") 6,"L1TITLE",L1TITLE.PERSONNL 6,"L1NAME",lettername.PERSONNL 6,"COMPANY",COMPANY.PERSONNL COMPANY$COMPANY.PERSONNL COMPANY$"COMPANY""COMPANY" 6,"ADDRESS",ADDRESS.COMPANY IF (HOME_ADDRES2.PERSONNL = "") THEN GOTO SKIP1 DDEPOKE 6,"HOME_ADDRESS2",HOME_ADDRES2.PERSONNL SKIP1: 6,"CITYSTZIP",citySTZIP.COMPANY Note: Long text fields with returns will keep their returns in the Word document. LETTERTITLE$"LETTER""TITLE" 6,"intro1",I1.LETTER 6,"intro2",I2.LETTER 6,"intro3",I3.LETTER 6,"body1",B1.LETTER 6,"body2",B2.LETTER 6,"body3",B3.LETTER 6,"CONCLUSION1",C1.LETTER 6,"CONCLUSION2",C2.LETTER 6,"CONCLUSION3",C3.LETTER DDEPOKE 6,"CONCLUSION",CONCLUSION.LETTER EditSelectAll selects all the Word document to update it. 6,"[EditSelectAll]" UpdateFields updates all the bookmarks and reference fields. cmd$"[UpdateFields]" 6,cmd$ StartOfDocument de-selects document and places cursor at start of document. 6,"[StartOfDocument]" FilePrint will print out the document to the printer IF CHECKPRINT$ = "P" THEN GOTO FILEPRINT cmd$"[AppMaximize]" 6,cmd$ "Microsoft Word" e "Press CTRL ESC KEYS Select Microsoft Word ","Is the letter correct ?",1,ans%% ans%%0pwVIEWQUITE FileClose closes the document. The 2 tells Word not the save file with data. Normally, you wouldn't want to save the data in the document so 2 prevents this. VIEWQUITE: 6,"[FileExit 2]" 5 6 7 "letter"   REPORT1(): Jan/21/1994 "c:\SB4W\CAPSUGEL" "PERSONNL" "COMPANY" "PARA" "LETTER" DDETERM makes sure all DDE channels are closed. 5 6 7 CHECKPRINT$"" ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"Microsoft Word" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\*.doc" "SELECT A WORD FILE FROM THE LIST PROVIDED","",18,A%,wordfile$ Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks. Notice the LEFT$(firstname.GSFSIMEM,1) is a calculation for the first initial of he FIRST - name. "PERSONNL" ~ ` OB("PERSONNL") 6,"L1TITLE",L1TITLE.PERSONNL 6,"L1NAME",lettername.PERSONNL 6,"COMPANY",COMPANY.PERSONNL COMPANY$COMPANY.PERSONNL COMPANY$"COMPANY""COMPANY" 6,"ADDRESS",ADDRESS.COMPANY IF (HOME_ADDRES2.PERSONNL = "") THEN GOTO SKIP1 DDEPOKE 6,"HOME_ADDRESS2",HOME_ADDRES2.PERSONNL SKIP1: 6,"CITYSTZIP",citySTZIP.COMPANY Note: Long text fields with returns will keep their returns in the Word document. LETTERTITLE$"LETTER""TITLE" 6,"intro1",I1.LETTER 6,"intro2",I2.LETTER 6,"intro3",I3.LETTER 6,"body1",B1.LETTER 6,"body2",B2.LETTER 6,"body3",B3.LETTER 6,"CONCLUSION1",C1.LETTER 6,"CONCLUSION2",C2.LETTER 6,"CONCLUSION3",C3.LETTER DDEPOKE 6,"CONCLUSION",CONCLUSION.LETTER EditSelectAll selects all the Word document to update it. 6,"[EditSelectAll]" UpdateFields updates all the bookmarks and reference fields. cmd$"[UpdateFields]" 6,cmd$ StartOfDocument de-selects document and places cursor at start of document. 6,"[StartOfDocument]" FilePrint will print out the document to the printer CHECKPRINT$"P"pwFILEPRINT cmd$"[FilePrintPreview]" 6,cmd$ "Microsoft Word" "Is the letter correct ?","If correct press OK to print / CANCEL to stop print",1,ans%% ans%%1pwFILEPRINT ^wFILEEDIT FILEPRINT: CHECKPRINT$"P" cmd$"[FilePrint]" 6,cmd$ "PERSONNL" FileClose closes the document. The 2 tells Word not the save file with data. Normally, you wouldn't want to save the data in the document so 2 prevents this. FILEEDIT: DDEEXEC 6,"[FileClose 2]" 6,"[FileExit 2]" 5 6 7 "letter"   MSWORD1(): 5 6 ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\letter1.doc" Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks.  MSWORD2(): 5 6 ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\letter2.doc" Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks.  MSWORD3(): 5 6 ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\letter3.doc" Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks.  MSWORD4(): 5 6 ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1 Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\letter4.doc" Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks.  MSWORD5(): 5 6 ch$(34) Open MS Word. Checks to see if MS Word is already open. If so, continues on. If not, then Superbase opens MS Word. This section uses a Windows DLL CALL TO perform this function. "Kernel","GetModuleHandle","IC" modname$"WinWord" hMod%("GetModuleHandle",modname$) Change the path to reflect your actual MS Word directory if necessary. (hMod%0)p"c:\msoffice\winword\winword.exe",1  Open DDE channel to the System Topic. Useful for non-document commands. 5,"WinWord","system" Place the path and name of your document inside the "". wordfile$"c:\letters\letter5.doc" Open your document and initialize the channel to that document. 5,"[FileOpen.name = "ch$wordfile$ch$"]" 6,"WinWord",wordfile$ Here is where you begin placing data into the bookmarks.