Bianchi928
asked on
Create PDF
How can I modity this script to create a pdf with some fancy fonts instead of txt
Thanks
Cheers
Dim objWMIService, objitem, colitems, objFSO, strFile, objFile
Const ForWriting = 2
Const CreateIfNotExist = True
Set objExcel = CreateObject("Excel.Applic ation")
Set objWorkbook = objExcel.Workbooks.Open("C :\Document s and Settings\Administrator\Des ktop\xlsbi llfile.xls ")
intRow = 2
Do Until objExcel.Cells(intRow,1).V alue = ""
strFile = "C:\Documents and Settings\Administrator\Des ktop\Phone Bills\" & objExcel.Cells(intRow, 4).Value & ".txt"
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objFile = objFSO.OpenTextFile(strFil e, ForWriting, CreateIfNotExist)
objFile.WriteLine "Mobile Phone Usage for the month of March 2012"
objfile.WriteLine ""
objfile.WriteLine "Mobile NUmber :" & objExcel.Cells(intRow, 1).Value
objfile.WriteLine "Amount :" & "$" & objExcel.Cells(intRow, 2).Value
intRow = intRow + 1
Loop
objExcel.Quit
objfile.close
Wscript.echo "Job Done"
Thanks
Cheers
Dim objWMIService, objitem, colitems, objFSO, strFile, objFile
Const ForWriting = 2
Const CreateIfNotExist = True
Set objExcel = CreateObject("Excel.Applic
Set objWorkbook = objExcel.Workbooks.Open("C
intRow = 2
Do Until objExcel.Cells(intRow,1).V
strFile = "C:\Documents and Settings\Administrator\Des
Set objFSO = CreateObject("Scripting.Fi
Set objFile = objFSO.OpenTextFile(strFil
objFile.WriteLine "Mobile Phone Usage for the month of March 2012"
objfile.WriteLine ""
objfile.WriteLine "Mobile NUmber :" & objExcel.Cells(intRow, 1).Value
objfile.WriteLine "Amount :" & "$" & objExcel.Cells(intRow, 2).Value
intRow = intRow + 1
Loop
objExcel.Quit
objfile.close
Wscript.echo "Job Done"
Why not print the excel sheet through a PDF print driver?
http://www.cutepdf.com/products/cutepdf/writer.asp
http://www.bullzip.com/products/pdf/info.php
Cheers,
Chris
http://www.cutepdf.com/products/cutepdf/writer.asp
http://www.bullzip.com/products/pdf/info.php
Cheers,
Chris
ASKER
Thanks for that. That's where I need help. I have a printer called FinePrint PDFFactory and I want to automate the printing. I don't want any user interaction.
I found this while trawling Google
http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/06/save-a-microsoft-excel-workbook-as-a-pdf-file-by-using-powershell.aspx
Does it fit your requirement?
If not, then Googling for "Powershell print office document" should turn up the code you need.
Cheers,
Chris
http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/06/save-a-microsoft-excel-workbook-as-a-pdf-file-by-using-powershell.aspx
Does it fit your requirement?
If not, then Googling for "Powershell print office document" should turn up the code you need.
Cheers,
Chris
ASKER
HI Chris,
You got me on the right track. I found this little Powershell thing that workjs only for one file
$word = new-object -ComObject "word.application"
$doc = $word.documents.open("C:\d ocument.do c")
$saveaspath = [ref] "c:\document.pdf"
$formatPDF = [ref] 17
$doc.SaveAs($saveaspath,$f ormatPDF)
$doc.Close()
How can I modify to make it read & convert all the *.doc file from a directory tp pdf
You got me on the right track. I found this little Powershell thing that workjs only for one file
$word = new-object -ComObject "word.application"
$doc = $word.documents.open("C:\d
$saveaspath = [ref] "c:\document.pdf"
$formatPDF = [ref] 17
$doc.SaveAs($saveaspath,$f
$doc.Close()
How can I modify to make it read & convert all the *.doc file from a directory tp pdf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oops I found the problem to the script
ASKER
Thanks
Here is one: http://bytescout.com/products/developer/pdfdocscoutsdk/pdfdocscout_example_vbscript.html