hi how can i open excel from vbscript
and print it?
please help!

Re: Excel help by McKirahan

McKirahan
Tue Jan 20 07:45:38 CST 2004

"Organza" <elin707@hotmail.com> wrote in message
news:#HqKzg03DHA.1804@TK2MSFTNGP12.phx.gbl...
> hi how can i open excel from vbscript
> and print it?
> please help!

Try this:

Option Explicit
'*
Const cVBS = "excel.vbs"
Const cXLS = "excel.xls"
'*
Dim strSFN
strSFN = WScript.ScriptFullName
strSFN = Left(strSFN,InStrRev(strSFN,"\"))
'*
Call Excel()

Sub Excel()
Dim objXLA
Set objXLA = CreateObject("Excel.Application")
objXLA.Visible = True
objXLA.UserControl = True
objXLA.Workbooks.Open strSFN & cXLS
objXLA.Workbooks(1).PrintOut
objXLA.Application.DisplayAlerts = False
objXLA.Quit
Set objXLA = Nothing
End Sub



Re: Excel help by Organza

Organza
Tue Jan 20 19:54:09 CST 2004

thank for your resopnse.

A. he doesnt know what is it WScript

B. activex cannot create object

Thanks

p.s.

have excel on my computer



"McKirahan" <News@McKirahan.com> wrote in message
news:6iaPb.106141$8H.191231@attbi_s03...
> "Organza" <elin707@hotmail.com> wrote in message
> news:#HqKzg03DHA.1804@TK2MSFTNGP12.phx.gbl...
> > hi how can i open excel from vbscript
> > and print it?
> > please help!
>
> Try this:
>
> Option Explicit
> '*
> Const cVBS = "excel.vbs"
> Const cXLS = "excel.xls"
> '*
> Dim strSFN
> strSFN = WScript.ScriptFullName
> strSFN = Left(strSFN,InStrRev(strSFN,"\"))
> '*
> Call Excel()
>
> Sub Excel()
> Dim objXLA
> Set objXLA = CreateObject("Excel.Application")
> objXLA.Visible = True
> objXLA.UserControl = True
> objXLA.Workbooks.Open strSFN & cXLS
> objXLA.Workbooks(1).PrintOut
> objXLA.Application.DisplayAlerts = False
> objXLA.Quit
> Set objXLA = Nothing
> End Sub
>
>



Re: Excel help by McKirahan

McKirahan
Tue Jan 20 08:40:25 CST 2004

"Organza" <elin707@hotmail.com> wrote in message
news:#$3R8013DHA.1704@tk2msftngp13.phx.gbl...
> thank for your resopnse.
>
> A. he doesnt know what is it WScript
>
> B. activex cannot create object
>
> Thanks
>
> p.s.
>
> have excel on my computer
>


Try running it from a command prompt:

cscript.exe //nologo excel.vbs




Re: Excel help by K

K
Wed Jan 21 16:05:38 CST 2004

I've had some success with oExcel=GetObject("',"Excel.Application"). I use
this with client side scripting...

oWrkBk=oExcel.Workbook.add
oExcel.visible=true


Having said that, I am having some trouble with some PC's but am working on
it.

HTH.


"Organza" <elin707@hotmail.com> wrote in message
news:#$3R8013DHA.1704@tk2msftngp13.phx.gbl...
> thank for your resopnse.
>
> A. he doesnt know what is it WScript
>
> B. activex cannot create object
>
> Thanks
>
> p.s.
>
> have excel on my computer
>
>
>
> "McKirahan" <News@McKirahan.com> wrote in message
> news:6iaPb.106141$8H.191231@attbi_s03...
> > "Organza" <elin707@hotmail.com> wrote in message
> > news:#HqKzg03DHA.1804@TK2MSFTNGP12.phx.gbl...
> > > hi how can i open excel from vbscript
> > > and print it?
> > > please help!
> >
> > Try this:
> >
> > Option Explicit
> > '*
> > Const cVBS = "excel.vbs"
> > Const cXLS = "excel.xls"
> > '*
> > Dim strSFN
> > strSFN = WScript.ScriptFullName
> > strSFN = Left(strSFN,InStrRev(strSFN,"\"))
> > '*
> > Call Excel()
> >
> > Sub Excel()
> > Dim objXLA
> > Set objXLA = CreateObject("Excel.Application")
> > objXLA.Visible = True
> > objXLA.UserControl = True
> > objXLA.Workbooks.Open strSFN & cXLS
> > objXLA.Workbooks(1).PrintOut
> > objXLA.Application.DisplayAlerts = False
> > objXLA.Quit
> > Set objXLA = Nothing
> > End Sub
> >
> >
>
>



Re: Excel help by Michael

Michael
Wed Jan 21 20:54:34 CST 2004

K. Lobe wrote:
> I've had some success with oExcel=GetObject("',"Excel.Application").
> I use this with client side scripting...
>
> oWrkBk=oExcel.Workbook.add
> oExcel.visible=true
>
>
> Having said that, I am having some trouble with some PC's but am
> working on it.


GetObject once worked client side in older versions of IE, but not in
current verions.

PRB: Cannot Call GetObject from IE to Access Running Object
http://support.microsoft.com/default.aspx?kbid=239470

Given the 'applies to" list, the KB article implies this was a change as of
IE 5.


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en