Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   create pdf file from vba (http://www.outlookbanter.com/outlook-vba/14406-create-pdf-file-vba.html)

Nader May 11th 06 10:31 AM

create pdf file from vba
 
Hello,

I've code right here that create a pdf from any document and merge it to
another existing pdf. My only problem is that when I use the function
avFormCapture.Open "", "" to create the pdf, the files is opened.

Is there way so nothing open or instead just some kind of progress bar ?

Thanks

The code I use :

Option Compare Database
Option Explicit

Sub Attach2Pdf()

Dim objCurrent As AccessObject
Dim Acroapp As CAcroApp
Dim avCodeFile As CAcroAVDoc
Dim avFormCapture As CAcroAVDoc
Dim pdCodeFile As CAcroPDDoc
Dim pdFormCapture As CAcroPDDoc
Dim lngPage As Long

'Start Acrobat in the background
Set Acroapp = CreateObject("AcroExch.App")

'Uncomment the following line if you want to watch the program run
'Acroapp.Show

Set avCodeFile = CreateObject("AcroExch.AVDoc") 'This is the code file
Set avFormCapture = CreateObject("AcroExch.AVDoc") 'This will be each
jpg in turn

'Open the fax
avCodeFile.Open "C:\Documentation\CodeFile.pdf", "Fax Sent"
Set pdCodeFile = avCodeFile.GetPDDoc

'Open the receipt in order to be merged with the fax
avFormCapture.Open "C:\Documentation\email.doc", "Fax Receipt"
Set pdFormCapture = avFormCapture.GetPDDoc

lngPage = pdCodeFile.GetNumPages - 1

'Insert the file at the right page
pdCodeFile.InsertPages lngPage, pdFormCapture, 0, 1, 0

pdFormCapture.Close
avFormCapture.Close 1
Set pdFormCapture = Nothing

'close the doc file now with form captures
pdCodeFile.Close
avCodeFile.Close 0

'Exit Acrobat
Acroapp.Exit
Set objCurrent = Nothing
Set Acroapp = Nothing
Set avCodeFile = Nothing
Set pdCodeFile = Nothing
Set avFormCapture = Nothing

End Sub



Ken Slovak - [MVP - Outlook] May 11th 06 04:03 PM

create pdf file from vba
 
And your Outlook programming question is... ?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Nader" wrote in message
...
Hello,

I've code right here that create a pdf from any document and merge it to
another existing pdf. My only problem is that when I use the function
avFormCapture.Open "", "" to create the pdf, the files is

opened.

Is there way so nothing open or instead just some kind of progress bar ?

Thanks

The code I use :

Option Compare Database
Option Explicit

Sub Attach2Pdf()

Dim objCurrent As AccessObject
Dim Acroapp As CAcroApp
Dim avCodeFile As CAcroAVDoc
Dim avFormCapture As CAcroAVDoc
Dim pdCodeFile As CAcroPDDoc
Dim pdFormCapture As CAcroPDDoc
Dim lngPage As Long

'Start Acrobat in the background
Set Acroapp = CreateObject("AcroExch.App")

'Uncomment the following line if you want to watch the program run
'Acroapp.Show

Set avCodeFile = CreateObject("AcroExch.AVDoc") 'This is the code file
Set avFormCapture = CreateObject("AcroExch.AVDoc") 'This will be each
jpg in turn

'Open the fax
avCodeFile.Open "C:\Documentation\CodeFile.pdf", "Fax Sent"
Set pdCodeFile = avCodeFile.GetPDDoc

'Open the receipt in order to be merged with the fax
avFormCapture.Open "C:\Documentation\email.doc", "Fax Receipt"
Set pdFormCapture = avFormCapture.GetPDDoc

lngPage = pdCodeFile.GetNumPages - 1

'Insert the file at the right page
pdCodeFile.InsertPages lngPage, pdFormCapture, 0, 1, 0

pdFormCapture.Close
avFormCapture.Close 1
Set pdFormCapture = Nothing

'close the doc file now with form captures
pdCodeFile.Close
avCodeFile.Close 0

'Exit Acrobat
Acroapp.Exit
Set objCurrent = Nothing
Set Acroapp = Nothing
Set avCodeFile = Nothing
Set pdCodeFile = Nothing
Set avFormCapture = Nothing

End Sub




Nader May 11th 06 06:38 PM

create pdf file from vba
 
sorry I wasn't thinking.
Is there a way to create a pdf using vba from an outlook message ?
thanks.

"Ken Slovak - [MVP - Outlook]" a écrit dans le message
de news: ...
And your Outlook programming question is... ?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Nader" wrote in message
...
Hello,

I've code right here that create a pdf from any document and merge it to
another existing pdf. My only problem is that when I use the function
avFormCapture.Open "", "" to create the pdf, the files is

opened.

Is there way so nothing open or instead just some kind of progress bar ?

Thanks

The code I use :

Option Compare Database
Option Explicit

Sub Attach2Pdf()

Dim objCurrent As AccessObject
Dim Acroapp As CAcroApp
Dim avCodeFile As CAcroAVDoc
Dim avFormCapture As CAcroAVDoc
Dim pdCodeFile As CAcroPDDoc
Dim pdFormCapture As CAcroPDDoc
Dim lngPage As Long

'Start Acrobat in the background
Set Acroapp = CreateObject("AcroExch.App")

'Uncomment the following line if you want to watch the program run
'Acroapp.Show

Set avCodeFile = CreateObject("AcroExch.AVDoc") 'This is the code file
Set avFormCapture = CreateObject("AcroExch.AVDoc") 'This will be each
jpg in turn

'Open the fax
avCodeFile.Open "C:\Documentation\CodeFile.pdf", "Fax Sent"
Set pdCodeFile = avCodeFile.GetPDDoc

'Open the receipt in order to be merged with the fax
avFormCapture.Open "C:\Documentation\email.doc", "Fax Receipt"
Set pdFormCapture = avFormCapture.GetPDDoc

lngPage = pdCodeFile.GetNumPages - 1

'Insert the file at the right page
pdCodeFile.InsertPages lngPage, pdFormCapture, 0, 1, 0

pdFormCapture.Close
avFormCapture.Close 1
Set pdFormCapture = Nothing

'close the doc file now with form captures
pdCodeFile.Close
avCodeFile.Close 0

'Exit Acrobat
Acroapp.Exit
Set objCurrent = Nothing
Set Acroapp = Nothing
Set avCodeFile = Nothing
Set pdCodeFile = Nothing
Set avFormCapture = Nothing

End Sub






Ken Slovak - [MVP - Outlook] May 12th 06 03:26 PM

create pdf file from vba
 
Not unless you have some addin or other code that would create a PDF file,
Outlook has no native support for PDF and neither does VBA.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Nader" wrote in message
...
sorry I wasn't thinking.
Is there a way to create a pdf using vba from an outlook message ?
thanks.




All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com