JasmineCorp Directory   
  
Usenet News Group Archives!!!

Usenet Groups:

 

 

 

 

 

Re: Script Errors Out
--------------------------------------------------------------------------------------------
Newsgroup: microsoft.public.excel.misc
Posted by: Dave Peterson
2007-05-19 16:32:52

Or

objworkbook.worksheets(1).name = format(date,"mmddyy")



Jeff C wrote:
>
> Got It, Thank you for your help!!!
>
> strYear = Right(DatePart("yyyy",Date), 2)
> strMonth = Right(100+DatePart("m",Date),2)
> strDay = Right(100+DatePart("d",Date),2)
>
> Set objExcel = CreateObject("Excel.Application")
> Set objWorkbook = objExcel.Workbooks.Open("c:\New.xls")
> Set objWorkbook1 = objExcel.Workbooks.Open("c:\Existing.xls")
>
> objworkbook.worksheets(1).name = strMonth & strDay & strYear
>
> objWorkbook.Worksheets(1).Copy objWorkbook1.Worksheets(1)
>
> objWorkbook1.Close True
> objWorkbook.Close True
> --
> Jeff C
> Live Well .. Be Happy In All You Do
>
> "Jim Rech" wrote:
>
> > You cannot use named arguments in a script, only by position.
> >
> > Set objExcel = CreateObject("Excel.Application")
> > Set objWorkbook = objExcel.Workbooks.Open("c:\New.xls")
> > Set objWorkbook1 = objExcel.Workbooks.Open("c:\Existing.xls")
> >
> > objWorkbook.Worksheets(1).Copy objWorkbook1.Worksheets(1)
> >
> > objWorkbook1.Close True
> > objWorkbook.Close
> >
> > --
> > Jim
> > "Jeff C" wrote in message
> > news:47104EF9-6BBF-4EBB-BD22-89F03F22D451@microsoft.com...
> > > Set objExcel = CreateObject("Excel.Application")
> > > Set objWorkbook = objExcel.Workbooks.Open("New.xls")
> > > Set objWorkbook1 = objExcel.Workbooks.Open("Existing.xls")
> > >
> > > objWorkbook.Worksheets(1).Copy before_
> > > objWorkbook1.Worksheets(1)
> > >
> > > objWorkbook1.Close SaveChanges = True
> > > objWorkbook.Close
> > >
> > > There is one worksheet in New.xls which I want to copy and add to
> > > Exisiting.xls as the top tab. The above errors out and I have re-written
> > > so
> > > many times I can't remember where I started. I also wanted to name the
> > > new
> > > worksheet with the date but couldn't get syntax that would work.
> > >
> > > This is a *.vbs text file that I want to place in the task scheduler.
> > >
> > > Am using MS Office Pro 2003. I appreciate any assist. Thanks
> > > --
> > > Jeff C
> > > Live Well .. Be Happy In All You Do
> >
> >
> >

--

Dave Peterson

 

 

 

More >> 

Domain Registration:
.com .org .net
.info .biz .us