Prev: Word 2002: Textbox Fixed width and autosize height
Next: Save each file in a folder as a filtered HTML file and also as a PDF file
From: Nanning99 on 18 Dec 2009 17:12 I had forgotten about the SendKeys command, so I tried (and have had success) using the following commands to solve the problem I posed (a VB command that does the equivalent of clicking the "Convert to Adobe PDF" button). I used the SendKeys command with the menu hot keys: SendKeys "%(B)", True ' % for Alt; B for hot key in "Adobe PDF" menu item SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu "Nanning99" wrote: > Thank you, Doug, Gordon, Brian, and Graham. > > "Graham Mayor" wrote: > > > Others have commented on 'printing' to the PDF driver, which may work for > > you, but to program the equivalent of the Convert to Adobe PDF function is a > > tad more complicated and requires a reference to the AdobePDFMakerForOffice > > object to be set. You could them use this code, which came up recently in > > this forum to Convert to PDF. > > > > > > Sub ConvertToPDF() > > Dim pdfname, i, a > > Dim pmkr As AdobePDFMakerForOffice.PDFMaker > > Dim stng As AdobePDFMakerForOffice.ISettings > > With ActiveDocument > > 'The document must be saved - so save it! > > .Save > > Set pmkr = Nothing ' locate PDFMaker object > > For Each a In Application.COMAddIns > > If InStr(UCase(a.Description), "PDFMAKER") > 0 Then > > Set pmkr = a.Object > > Exit For > > End If > > Next > > If pmkr Is Nothing Then > > MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, "" > > Exit Sub > > End If > > pdfname = Left(.name, InStrRev(.name, ".")) & "pdf" > > ' delete PDF file if it already exists > > If Dir(pdfname) <> "" Then Kill pdfname > > pmkr.GetCurrentConversionSettings stng > > stng.AddBookmarks = True ' make desired settings > > stng.AddLinks = True > > stng.AddTags = False > > stng.ConvertAllPages = True > > stng.CreateFootnoteLinks = True > > stng.CreateXrefLinks = True > > stng.OutputPDFFileName = pdfname > > stng.PromptForPDFFilename = False > > stng.ShouldShowProgressDialog = True > > stng.ViewPDFFile = False > > pmkr.CreatePDFEx stng, 0 'perform conversion > > If Dir(pdfname) = "" Then ' see if conversion failed > > MsgBox "Could not create " & pdfname, vbOKOnly, "Conversion failed" > > End If > > End With > > End Sub > > > > > > -- > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > Graham Mayor - Word MVP > > > > My web site www.gmayor.com > > Word MVP web site http://word.mvps.org > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > > > Nanning99 wrote: > > > Does anyone know if there is a Visual Basic command (to insert in a > > > macro) to print an Adobe PDF (a command that does the equivalent of > > > clicking the "Convert to Adobe PDF" button)? > > > > > > Thanks > > > > > > "garfield-n-odie" wrote: > > > > > >> If you have Acrobat installed correctly, then to get it from Word > > >> to Acrobat, you can either click on the "Convert to Adobe PDF" > > >> button on the Acrobat toolbar in Word, or print to the Acrobat > > >> PDFWriter printer in the File->Print menu. > > >> > > >> adiercks(a)aol.com wrote: > > >> > > >>> Thank you but, I can't get it from Word to Acrobat . . . > > >>> > > >>> "garfield-n-odie" wrote: > > >>> > > >>> > > >>>> You need the to get the full version of Adobe Acrobat (not just > > >>>> the free Adobe Reader... see > > >>>> http://www.adobe.com/products/acrobat/main.html ) or one of > > >>>> Acrobat's many shareware and freeware clones (see > > >>>> http://www.google.com/search?hl=en&lr=&q=pdf+converter&btnG=Search > > >>>> ) . > > >>>> > > >>>> adiercks(a)aol.com wrote: > > >>>> > > >>>> > > >>>>> I am trying to convert a .doc file ( a manuscript ) to a .pdf to > > >>>>> transfer to Palm. Adding converters was not the answer. > > > > > > . > >
From: Nanning99 on 19 Dec 2009 12:13 So sorry. I put parentheses instead of brackets--{}--in the first command. It should be: SendKeys "%{B}", True ' % for Alt; B for hot key in "Adobe PDF" menu item SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu "Nanning99" wrote: > I had forgotten about the SendKeys command, so I tried (and have had success) > using the following commands to solve the problem I posed (a VB command that > does the equivalent of clicking the "Convert to Adobe PDF" button). I used > the SendKeys command with the menu hot keys: > > SendKeys "%(B)", True ' % for Alt; B for hot key in "Adobe PDF" menu item > SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu > > "Nanning99" wrote: > > > Thank you, Doug, Gordon, Brian, and Graham. > > > > "Graham Mayor" wrote: > > > > > Others have commented on 'printing' to the PDF driver, which may work for > > > you, but to program the equivalent of the Convert to Adobe PDF function is a > > > tad more complicated and requires a reference to the AdobePDFMakerForOffice > > > object to be set. You could them use this code, which came up recently in > > > this forum to Convert to PDF. > > > > > > > > > Sub ConvertToPDF() > > > Dim pdfname, i, a > > > Dim pmkr As AdobePDFMakerForOffice.PDFMaker > > > Dim stng As AdobePDFMakerForOffice.ISettings > > > With ActiveDocument > > > 'The document must be saved - so save it! > > > .Save > > > Set pmkr = Nothing ' locate PDFMaker object > > > For Each a In Application.COMAddIns > > > If InStr(UCase(a.Description), "PDFMAKER") > 0 Then > > > Set pmkr = a.Object > > > Exit For > > > End If > > > Next > > > If pmkr Is Nothing Then > > > MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, "" > > > Exit Sub > > > End If > > > pdfname = Left(.name, InStrRev(.name, ".")) & "pdf" > > > ' delete PDF file if it already exists > > > If Dir(pdfname) <> "" Then Kill pdfname > > > pmkr.GetCurrentConversionSettings stng > > > stng.AddBookmarks = True ' make desired settings > > > stng.AddLinks = True > > > stng.AddTags = False > > > stng.ConvertAllPages = True > > > stng.CreateFootnoteLinks = True > > > stng.CreateXrefLinks = True > > > stng.OutputPDFFileName = pdfname > > > stng.PromptForPDFFilename = False > > > stng.ShouldShowProgressDialog = True > > > stng.ViewPDFFile = False > > > pmkr.CreatePDFEx stng, 0 'perform conversion > > > If Dir(pdfname) = "" Then ' see if conversion failed > > > MsgBox "Could not create " & pdfname, vbOKOnly, "Conversion failed" > > > End If > > > End With > > > End Sub > > > > > > > > > -- > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > Graham Mayor - Word MVP > > > > > > My web site www.gmayor.com > > > Word MVP web site http://word.mvps.org > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > > > > > > Nanning99 wrote: > > > > Does anyone know if there is a Visual Basic command (to insert in a > > > > macro) to print an Adobe PDF (a command that does the equivalent of > > > > clicking the "Convert to Adobe PDF" button)? > > > > > > > > Thanks > > > > > > > > "garfield-n-odie" wrote: > > > > > > > >> If you have Acrobat installed correctly, then to get it from Word > > > >> to Acrobat, you can either click on the "Convert to Adobe PDF" > > > >> button on the Acrobat toolbar in Word, or print to the Acrobat > > > >> PDFWriter printer in the File->Print menu. > > > >> > > > >> adiercks(a)aol.com wrote: > > > >> > > > >>> Thank you but, I can't get it from Word to Acrobat . . . > > > >>> > > > >>> "garfield-n-odie" wrote: > > > >>> > > > >>> > > > >>>> You need the to get the full version of Adobe Acrobat (not just > > > >>>> the free Adobe Reader... see > > > >>>> http://www.adobe.com/products/acrobat/main.html ) or one of > > > >>>> Acrobat's many shareware and freeware clones (see > > > >>>> http://www.google.com/search?hl=en&lr=&q=pdf+converter&btnG=Search > > > >>>> ) . > > > >>>> > > > >>>> adiercks(a)aol.com wrote: > > > >>>> > > > >>>> > > > >>>>> I am trying to convert a .doc file ( a manuscript ) to a .pdf to > > > >>>>> transfer to Palm. Adding converters was not the answer. > > > > > > > > > . > > >
From: Nanning99 on 24 Dec 2009 17:37
Again, my apologies. I was right the first time. (I use the macro at work, but I cannot access the discussion group at work, so I've been doing this by memory.) The 1st line does use parentheses--(B)--rather than braces: SendKeys "%(B)", True ' % for Alt; B for hot key in "Adobe PDF" menu item SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu "Nanning99" wrote: > So sorry. I put parentheses instead of brackets--{}--in the first command. It > should be: > > SendKeys "%{B}", True ' % for Alt; B for hot key in "Adobe PDF" menu item > SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu > > "Nanning99" wrote: > > > I had forgotten about the SendKeys command, so I tried (and have had success) > > using the following commands to solve the problem I posed (a VB command that > > does the equivalent of clicking the "Convert to Adobe PDF" button). I used > > the SendKeys command with the menu hot keys: > > > > SendKeys "%(B)", True ' % for Alt; B for hot key in "Adobe PDF" menu item > > SendKeys "C", True ' C for hot key in "Convert to Adobe PDF" under above menu > > > > "Nanning99" wrote: > > > > > Thank you, Doug, Gordon, Brian, and Graham. > > > > > > "Graham Mayor" wrote: > > > > > > > Others have commented on 'printing' to the PDF driver, which may work for > > > > you, but to program the equivalent of the Convert to Adobe PDF function is a > > > > tad more complicated and requires a reference to the AdobePDFMakerForOffice > > > > object to be set. You could them use this code, which came up recently in > > > > this forum to Convert to PDF. > > > > > > > > > > > > Sub ConvertToPDF() > > > > Dim pdfname, i, a > > > > Dim pmkr As AdobePDFMakerForOffice.PDFMaker > > > > Dim stng As AdobePDFMakerForOffice.ISettings > > > > With ActiveDocument > > > > 'The document must be saved - so save it! > > > > .Save > > > > Set pmkr = Nothing ' locate PDFMaker object > > > > For Each a In Application.COMAddIns > > > > If InStr(UCase(a.Description), "PDFMAKER") > 0 Then > > > > Set pmkr = a.Object > > > > Exit For > > > > End If > > > > Next > > > > If pmkr Is Nothing Then > > > > MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, "" > > > > Exit Sub > > > > End If > > > > pdfname = Left(.name, InStrRev(.name, ".")) & "pdf" > > > > ' delete PDF file if it already exists > > > > If Dir(pdfname) <> "" Then Kill pdfname > > > > pmkr.GetCurrentConversionSettings stng > > > > stng.AddBookmarks = True ' make desired settings > > > > stng.AddLinks = True > > > > stng.AddTags = False > > > > stng.ConvertAllPages = True > > > > stng.CreateFootnoteLinks = True > > > > stng.CreateXrefLinks = True > > > > stng.OutputPDFFileName = pdfname > > > > stng.PromptForPDFFilename = False > > > > stng.ShouldShowProgressDialog = True > > > > stng.ViewPDFFile = False > > > > pmkr.CreatePDFEx stng, 0 'perform conversion > > > > If Dir(pdfname) = "" Then ' see if conversion failed > > > > MsgBox "Could not create " & pdfname, vbOKOnly, "Conversion failed" > > > > End If > > > > End With > > > > End Sub > > > > > > > > > > > > -- > > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > Graham Mayor - Word MVP > > > > > > > > My web site www.gmayor.com > > > > Word MVP web site http://word.mvps.org > > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > > > > > > > > > Nanning99 wrote: > > > > > Does anyone know if there is a Visual Basic command (to insert in a > > > > > macro) to print an Adobe PDF (a command that does the equivalent of > > > > > clicking the "Convert to Adobe PDF" button)? > > > > > > > > > > Thanks > > > > > > > > > > "garfield-n-odie" wrote: > > > > > > > > > >> If you have Acrobat installed correctly, then to get it from Word > > > > >> to Acrobat, you can either click on the "Convert to Adobe PDF" > > > > >> button on the Acrobat toolbar in Word, or print to the Acrobat > > > > >> PDFWriter printer in the File->Print menu. > > > > >> > > > > >> adiercks(a)aol.com wrote: > > > > >> > > > > >>> Thank you but, I can't get it from Word to Acrobat . . . > > > > >>> > > > > >>> "garfield-n-odie" wrote: > > > > >>> > > > > >>> > > > > >>>> You need the to get the full version of Adobe Acrobat (not just > > > > >>>> the free Adobe Reader... see > > > > >>>> http://www.adobe.com/products/acrobat/main.html ) or one of > > > > >>>> Acrobat's many shareware and freeware clones (see > > > > >>>> http://www.google.com/search?hl=en&lr=&q=pdf+converter&btnG=Search > > > > >>>> ) . > > > > >>>> > > > > >>>> adiercks(a)aol.com wrote: > > > > >>>> > > > > >>>> > > > > >>>>> I am trying to convert a .doc file ( a manuscript ) to a .pdf to > > > > >>>>> transfer to Palm. Adding converters was not the answer. > > > > > > > > > > > > . > > > > |