Every morning an Excel spreadsheet is generated with the same name
overwriting itself with new data, call it NEW.xls

Can someone guide me in writing a script that copies or writes this data
into a new worksheet in EXISTING.xls? How do you go about labeling
worksheets?

Thanking you in advance
--
Jeff C
Live Well .. Be Happy In All You Do

Re: Create New Worksheet by mr_unreliable

mr_unreliable
Wed May 16 14:40:45 CDT 2007

hi Jeff,

I'm not going to give you a fish, but I will tell you
how to fish for yourself.

Here's what you do. First off, go to google advanced
group search, and search this ng for "execl.application":

http://groups.google.com/advanced_group_search

that will provide you with some examples of how to control
excel from script through its automation interface.

Then go into excel, and turn on the "macro recorder",
and go through the steps you want your script to perform
"manually" (by just typing and mousing what you want
excel to do). When finished, stop the macro recorder,
and give your macro a name.

Then go into the macro editor, and look up the macro
you just created. What you see will be "vba" code,
not vbs code, but converting from vba to vbs is not
very difficult.

If you are having trouble converting, go back to google
adv grp search, and look for "vba to vbs". There have
been several postings over the years which contain all
the details of what to watch out for.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)



Jeff C wrote:
> Every morning an Excel spreadsheet is generated with the same name
> overwriting itself with new data, call it NEW.xls
>
> Can someone guide me in writing a script that copies or writes this data
> into a new worksheet in EXISTING.xls? How do you go about labeling
> worksheets?
>
> Thanking you in advance

Re: Create New Worksheet by JeffC

JeffC
Thu May 17 15:09:01 CDT 2007

I think I am close but am still not getting things to work. I cannot get a
"copy before" to work. the following runs but does nothing. Can anyone
offer some solution?

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("New.xls")
Set objWorkbook1 = objExcel.Workbooks.Open("Exisiting.xls")

objWorkbook.Sheets(1).Copy objWorkbook1.Sheets(1)

objWorkbook1.Close SaveChanges = True
objWorkbook.Close

I would sure appreciate the assist. Thanks
--
Jeff C
Live Well .. Be Happy In All You Do


"mr_unreliable" wrote:

> hi Jeff,
>
> I'm not going to give you a fish, but I will tell you
> how to fish for yourself.
>
> Here's what you do. First off, go to google advanced
> group search, and search this ng for "execl.application":
>
> http://groups.google.com/advanced_group_search
>
> that will provide you with some examples of how to control
> excel from script through its automation interface.
>
> Then go into excel, and turn on the "macro recorder",
> and go through the steps you want your script to perform
> "manually" (by just typing and mousing what you want
> excel to do). When finished, stop the macro recorder,
> and give your macro a name.
>
> Then go into the macro editor, and look up the macro
> you just created. What you see will be "vba" code,
> not vbs code, but converting from vba to vbs is not
> very difficult.
>
> If you are having trouble converting, go back to google
> adv grp search, and look for "vba to vbs". There have
> been several postings over the years which contain all
> the details of what to watch out for.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>
>
> Jeff C wrote:
> > Every morning an Excel spreadsheet is generated with the same name
> > overwriting itself with new data, call it NEW.xls
> >
> > Can someone guide me in writing a script that copies or writes this data
> > into a new worksheet in EXISTING.xls? How do you go about labeling
> > worksheets?
> >
> > Thanking you in advance
>