Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open IE by vbscript , How to print to PDF File

291 views
Skip to first unread message

moonhk

unread,
Oct 21, 2009, 12:06:04 PM10/21/09
to
Hi All

In excel worksheet,
Column A is web addresss
Column B is output file name e.g. "c:\temp\web_ibm"

Searched in Google more than one hours, can not able to found how to
print to PDF File. Any suggest to using PDF object ?

I want daily download some web page ,some page have graph, the html
may be have graph.


'~~ excel_web.vbs
'~~ 2009/10/22
'~~ http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.server.scripting/2008-04/msg00232.html
'~~ http://www.bytescout.com/pdfdocscout_example_vbscript.htm
Option Explicit
Dim objExcel
Dim objWorkBook
Dim oXMLHTTP
Dim objAcroPDF
Dim oStream
DIM ExcelName
Dim cnt, i
Dim Address , Output, Wdate, FN

ExcelName = "C:\temp\abc.xls"
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")
Set objExcel = CreateObject("Excel.Application")
Set objAcroPDF = CreateObject("AcroPDF.PDF")

Set objWorkbook = objExcel.Workbooks.Open (ExcelName)

wDate = Year(Now) & Right("00" & Month(Now), 2) & Right("00" & Day
(Now), 2) _
& "_" & right("00" & hour(now),2) & right("00" & Minute(now),
2) _
& right("00" & Second(now),2)

for i = 1 to 10
Address = objExcel.Cells(i, 1).Value
Output = objExcel.Cells(i, 2).Value
if trim(address) <> "" and trim(Output) <> "" and left(address,1) <>
"#" then
FN = Output & "_" & wDate & ".html"
Wscript.echo right("000" & i,3) & " " & Address & " " & FN

oXMLHTTP.Open "GET", Address , False
oXMLHTTP.Send

If oXMLHTTP.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write oXMLHTTP.responseBody
oStream.SaveToFile FN
oStream.Close
End If

end if
next

objExcel.Workbooks(1).Save 'Save the workbook, not excel file
objExcel.Workbooks(1).Close 'Close the workbook then finally quit
excel
objExcel.Quit
set objExcel = nothing
set OXMLHTTP = nothing

jonny

unread,
Nov 15, 2009, 2:34:36 AM11/15/09
to
Why do you just not take a screenshot, what pdf actually is ?

pdf is not useful?

It is the hideout of yesterday's mischievous beings .


"moonhk" <moo...@gmail.com> wrote in message
news:ccc37352-f048-49bd...@v15g2000prn.googlegroups.com...

0 new messages