Alaska Software Inc. - Macro in Word
Username: Password:
AuthorTopic: Macro in Word
RIBO SALAMANCAMacro in Word
on Fri, 16 May 2014 19:54:25 -0500
Macro in Word

Hello all

I am stuck with running the macro in Word .
This is not run by the given code .

The macro works fine running it from the developer of word mode.
What I need to generate the PDF output file are listed ?

# define vbext_ct_StdModule 1

CDBF : = ' d : \ mailmerge \ cartas.dbf '
cProgPath : = ' d : \ mailmerge \'
oWord : = CreateObject ( " Word.Application " )

oWord : visible . = T.

cFileWord : = cProgpath + ' carta.dotx '
oMyDoc : = oWord : documents : open ( cFileWord )
oMyDoc : MailMerge : OpenDataSource ( LETTERS , F. , F. , T., F.. . . . )
oMyDoc : MailMerge : Execute ( T. . )
oMyDoc : = oWord : ActiveDocument

******* Run the macro  to generate PDF .
               t : = oWord : Application : VBE : ActiveVBProject
               t : VBComponents : Add ( vbext_ct_StdModule )
               i: = t : VBComponents : count ()
               t : VBComponents ( i ) : CodeModule : AddFromFile ( cProgPath 
\ WordToPdf.vba ' )

cSaveAs : = cProgpath + ' cartasdef.doc "
oMyDoc : saveas ( cSaveAs )
oMyDoc : close ()
oWord : destroy ()

                             
The macro in VBA
                            /
WordToPDF Sub ()
'
' Macro ToPDF
' Convert Word to Pdf Files
'
    ActiveDocument.ExportAsFixedFormat OutputFileName : = _
        "d: \ ​​mailmerge \ Promissory - carta.pdf " ExportFormat : = _
        wdExportFormatPDF , OpenAfterExport : = True , optimizefor : = _
        wdExportOptimizeForPrint , Range : = wdExportAllDocument , From: = 1 
, To: = 1, _
        Item: = wdExportDocumentContent , IncludeDocProps : = True , KeepIRM 
: = True , _
        CreateBookmarks : = wdExportCreateNoBookmarks , DocStructureTags : = 
True , _
        BitmapMissingFonts : = True , UseISO19005_1 : = False
End Sub

I remain attentive,
Ribo Salamanca
From Colombia
Hector PezoaRe: Macro in Word
on Sat, 17 May 2014 15:42:21 -0400
Ribo

see Pdf Printing  22-10-2013
public.xbase++.gui

best regard
Hector

Ribo, porque no intentas trabajar con pdf creator,  en ese link que te 
indico
mas arriba hay un ejemplo con word
saludos


<RIBO SALAMANCA> escribi en el mensaje 
news:12952161$34b8f5c4$1692c1@news.alaska-software.com...
> Macro in Word
>
> Hello all
>
> I am stuck with running the macro in Word .
> This is not run by the given code .
>
> The macro works fine running it from the developer of word mode.
> What I need to generate the PDF output file are listed ?
>
> # define vbext_ct_StdModule 1
>
> CDBF : = ' d : \ mailmerge \ cartas.dbf '
> cProgPath : = ' d : \ mailmerge \'
> oWord : = CreateObject ( " Word.Application " )
>
> oWord : visible . = T.
>
> cFileWord : = cProgpath + ' carta.dotx '
> oMyDoc : = oWord : documents : open ( cFileWord )
> oMyDoc : MailMerge : OpenDataSource ( LETTERS , F. , F. , T., F.. . . . )
> oMyDoc : MailMerge : Execute ( T. . )
> oMyDoc : = oWord : ActiveDocument
>
> ******* Run the macro  to generate PDF .
>               t : = oWord : Application : VBE : ActiveVBProject
>               t : VBComponents : Add ( vbext_ct_StdModule )
>               i: = t : VBComponents : count ()
>               t : VBComponents ( i ) : CodeModule : AddFromFile ( 
> cProgPath \ WordToPdf.vba ' )
>
> cSaveAs : = cProgpath + ' cartasdef.doc "
> oMyDoc : saveas ( cSaveAs )
> oMyDoc : close ()
> oWord : destroy ()
>
>                              
> The macro in VBA
>                             /
> WordToPDF Sub ()
> '
> ' Macro ToPDF
> ' Convert Word to Pdf Files
> '
>    ActiveDocument.ExportAsFixedFormat OutputFileName : = _
>        "d: \ ??mailmerge \ Promissory - carta.pdf " ExportFormat : = _
>        wdExportFormatPDF , OpenAfterExport : = True , optimizefor : = _
>        wdExportOptimizeForPrint , Range : = wdExportAllDocument , From: = 
> 1 , To: = 1, _
>        Item: = wdExportDocumentContent , IncludeDocProps : = True , 
> KeepIRM : = True , _
>        CreateBookmarks : = wdExportCreateNoBookmarks , DocStructureTags : 
> = True , _
>        BitmapMissingFonts : = True , UseISO19005_1 : = False
> End Sub
>
> I remain attentive,
> Ribo Salamanca
> From Colombia
RIBO SALAMANCARe: Macro in Word
on Thu, 22 May 2014 13:12:01 -0500
Thanks Hector
This interesting, this solves partly my concern but plenty know how you run 
a macro for other purposes.

Someone to help me out with this concern.

I remain attentive,
Ribo Salamanca.

"Hector Pezoa"  escribió en el mensaje de 
noticias:4a128c03$2a2ea24f$1be21f@news.alaska-software.com...

Ribo

see Pdf Printing  22-10-2013
public.xbase++.gui

best regard
Hector

Ribo, porque no intentas trabajar con pdf creator,  en ese link que te
indico
mas arriba hay un ejemplo con word
saludos


<RIBO SALAMANCA> escribió en el mensaje
news:12952161$34b8f5c4$1692c1@news.alaska-software.com...
> Macro in Word
>
> Hello all
>
> I am stuck with running the macro in Word .
> This is not run by the given code .
>
> The macro works fine running it from the developer of word mode.
> What I need to generate the PDF output file are listed ?
>
> # define vbext_ct_StdModule 1
>
> CDBF : = ' d : \ mailmerge \ cartas.dbf '
> cProgPath : = ' d : \ mailmerge \'
> oWord : = CreateObject ( " Word.Application " )
>
> oWord : visible . = T.
>
> cFileWord : = cProgpath + ' carta.dotx '
> oMyDoc : = oWord : documents : open ( cFileWord )
> oMyDoc : MailMerge : OpenDataSource ( LETTERS , F. , F. , T., F.. . . . )
> oMyDoc : MailMerge : Execute ( T. . )
> oMyDoc : = oWord : ActiveDocument
>
> ******* Run the macro  to generate PDF .
>               t : = oWord : Application : VBE : ActiveVBProject
>               t : VBComponents : Add ( vbext_ct_StdModule )
>               i: = t : VBComponents : count ()
>               t : VBComponents ( i ) : CodeModule : AddFromFile ( 
> cProgPath \ WordToPdf.vba ' )
>
> cSaveAs : = cProgpath + ' cartasdef.doc "
> oMyDoc : saveas ( cSaveAs )
> oMyDoc : close ()
> oWord : destroy ()
>
>                              
> The macro in VBA
>                             /
> WordToPDF Sub ()
> '
> ' Macro ToPDF
> ' Convert Word to Pdf Files
> '
>    ActiveDocument.ExportAsFixedFormat OutputFileName : = _
>        "d: \ ??mailmerge \ Promissory - carta.pdf " ExportFormat : = _
>        wdExportFormatPDF , OpenAfterExport : = True , optimizefor : = _
>        wdExportOptimizeForPrint , Range : = wdExportAllDocument , From: = 
> 1 , To: = 1, _
>        Item: = wdExportDocumentContent , IncludeDocProps : = True , 
> KeepIRM : = True , _
>        CreateBookmarks : = wdExportCreateNoBookmarks , DocStructureTags : 
> = True , _
>        BitmapMissingFonts : = True , UseISO19005_1 : = False
> End Sub
>
> I remain attentive,
> Ribo Salamanca
> From Colombia