ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel to PDF conversion in VB (https://www.excelbanter.com/excel-discussion-misc-queries/26920-excel-pdf-conversion-vbulletin.html)

Paul Watkins

Excel to PDF conversion in VB
 
Hi
I have an excel sheet which i would like to convert to pdf via vb automatic
code.

What i want to do is click a button - run a macro that would convert the
sheet to PDF.
I recorded a macro when doing this manually, but when i run the code i
cannot get passed the save as dialog box.

Is there any code to do this?


Thanks in advance


Paul



Bill Martin -- (Remove NOSPAM from address)

Paul Watkins wrote:
Hi
I have an excel sheet which i would like to convert to pdf via vb automatic
code.

What i want to do is click a button - run a macro that would convert the
sheet to PDF.
I recorded a macro when doing this manually, but when i run the code i
cannot get passed the save as dialog box.

Is there any code to do this?


Thanks in advance


Paul


------------------------------

I'm not sure what you want to do, but what I have done is to install
PDF995. It's a free program on the web that acts like a printer driver.
You tell Excel (or any other program) to print what you want, and then
select PDF995 as the printer to send it to and it creates a PDF file
that's an image of what you selected to print.

Bill

Paul Watkins

Sorry i was not clear.

I have PDF995 installed, what i want to do is the automate this process via
VB code.
without having to fill in the save as dialog box.

Paul


"Bill Martin -- (Remove NOSPAM from address)"
wrote in message ...
Paul Watkins wrote:
Hi
I have an excel sheet which i would like to convert to pdf via vb
automatic code.

What i want to do is click a button - run a macro that would convert the
sheet to PDF.
I recorded a macro when doing this manually, but when i run the code i
cannot get passed the save as dialog box.

Is there any code to do this?


Thanks in advance


Paul

------------------------------

I'm not sure what you want to do, but what I have done is to install
PDF995. It's a free program on the web that acts like a printer driver.
You tell Excel (or any other program) to print what you want, and then
select PDF995 as the printer to send it to and it creates a PDF file
that's an image of what you selected to print.

Bill




Bill Martin -- (Remove NOSPAM from address)

Paul Watkins wrote:
Sorry i was not clear.

I have PDF995 installed, what i want to do is the automate this process via
VB code.
without having to fill in the save as dialog box.

Paul


Sorry, but I wouldn't know how to do that. It seems that you want to
run VB from Excel to control part of the OS. That's probably entirely
doable, but not by *me* <g.

Bill

Darcy

Hi Paul,

I'm going through a similar dilema myself. I've created a macro that does
pretty much what you're talking about, but the created file is either empty
(0 KB) or corrupted and won't open using Adobe. !?!?! Ugh.
This is some of the VB I used:

Application.ActivePrinter = "Adobe PDF on Ne00:"


For CoNo = 7 To 400
AppStr = "LoadCompany_" & CoNo
CellRefA = "A" & CoNo
CellRefB = "B" & CoNo
CoName = Range(CellRefB).Value
XStr = UCase(Range(CellRefA).Value)

If XStr = "X" Then
Application.Run AppStr
Sheets("SUMMARY").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
& CoName & ".pdf"
Sheets("FLEET").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
& CoName & "2.pdf"
Sheets("SELECT TO PRINT").Select

End If

Next CoNo

If you try this with PDF995 and find it works, let me know. I'm using Excel
XP and Adobe Acrobat 6.0

Thanx,
Darcy :o)

"Bill Martin -- (Remove NOSPAM from addre" wrote:

Paul Watkins wrote:
Sorry i was not clear.

I have PDF995 installed, what i want to do is the automate this process via
VB code.
without having to fill in the save as dialog box.

Paul


Sorry, but I wouldn't know how to do that. It seems that you want to
run VB from Excel to control part of the OS. That's probably entirely
doable, but not by *me* <g.

Bill



All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com