Connecting Tech Pros Worldwide Forums | Help | Site Map

Excel to PDF

Member
 
Join Date: Oct 2007
Location: Australia
Posts: 83
#1: Jan 7 '08
Hi all, I have a problem to convert PDF from excel file, i have installed PDF printer and i can make PDF file from excel by manually, I want to make it programetically in VB6. i made a set of code which is working but it sending to Physical printer printer directly, the code

Dim xlapp As excel.Application
Dim xlbook As excel.WorkBook
Dim xlsheet As excel.WorkSheet

Set xlbook = GetObject("d:\TEST.xls")
Set xlapp = xlbook.Parent
xlapp.Visible = True
xlapp.Windows("TEST.XLS").Visible = True
Set xlsheet = xlbook.Sheets("Sheet1")
xlsheet.PrintOut , , 1, , "\\server\ADOB PDF"

Pls give me advice where i did mistake, thx advance 4 ur time.

Member
 
Join Date: Jan 2008
Location: India
Posts: 46
#2: Jan 7 '08

re: Excel to PDF


Quote:

Originally Posted by shaiful

Hi all, I have a problem to convert PDF from excel file, i have installed PDF printer and i can make PDF file from excel by manually, I want to make it programetically in VB6. i made a set of code which is working but it sending to Physical printer printer directly, the code

Dim xlapp As excel.Application
Dim xlbook As excel.WorkBook
Dim xlsheet As excel.WorkSheet

Set xlbook = GetObject("d:\TEST.xls")
Set xlapp = xlbook.Parent
xlapp.Visible = True
xlapp.Windows("TEST.XLS").Visible = True
Set xlsheet = xlbook.Sheets("Sheet1")
xlsheet.PrintOut , , 1, , "\\server\ADOB PDF"

Pls give me advice where i did mistake, thx advance 4 ur time.


Make the PDF printer as the default printer of your system.

Check if the PDF printer you have installed provides any programmable objects. If so then add that to your references in your project and do it via this route.
Member
 
Join Date: Oct 2007
Location: Australia
Posts: 83
#3: Jan 7 '08

re: Excel to PDF


Quote:

Originally Posted by vikas000000a

Make the PDF printer as the default printer of your system.

Check if the PDF printer you have installed provides any programmable objects. If so then add that to your references in your project and do it via this route.

Actually, I have no idea that how to recognize the printer from network in VB6, if anybody help me to give some idea and which particular control or prefarence i sould use? Thx
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#4: Jan 8 '08

re: Excel to PDF


Quote:

Originally Posted by shaiful

Actually, I have no idea that how to recognize the printer from network in VB6, if anybody help me to give some idea and which particular control or prefarence i sould use? Thx

Hey shaiful!

I think what vikas000000a is saying is the printer you normally print to is your default, you can go to Printes and Faxes through Control Panel and change the default to your PDF printer.

I could me off base a bit...

Try anyway see if that works:-)
Member
 
Join Date: Oct 2007
Location: Australia
Posts: 83
#5: Jan 14 '08

re: Excel to PDF


Quote:

Originally Posted by Dököll

Hey shaiful!

I think what vikas000000a is saying is the printer you normally print to is your default, you can go to Printes and Faxes through Control Panel and change the default to your PDF printer.

Try anyway see if that works:-)

Hi I made PDF printer as a default printer. it is works. But i have many printer in my network and i need other printer as a default printer. Is there any way to select printer by code ? such as printer name =" \\server\PDF Printer", something like that, Thx again
Reply


Similar Visual Basic 4 / 5 / 6 bytes