Yes, notice how it works:
Set wso = Application.Workbooks.Add
Workbooks("Scheduler").Sheets("Schedule").Copy Before:=wso.Sheets(1)
The first line creates the new worksheet and creates an object reference
"wso" that points to it. Then the Copy method places it before
wso.Sheets("whichever sheet you specify").
--- "WLMPilot" wrote:
> So, after new workbook is created, the macro in the scheduler workbook would
> place the data in the new workbook?
>
> --- "Bob Bridges" wrote:
> > Creating a new workbook is easy: Just use
> >
> > Set wbo = Application.Workbooks.Add
> >
> > After that wbo points to the new workbook, and you can save it to a new file
> > whenever you're ready. Transferring the data from some workbook to a sheet
> > in the new one ought to be almost as easy, though I've never tried it before.
> > How about this?
> >
> > Workbooks("Scheduler").Sheets("Schedule").Copy Before:=wbo.Sheets(1)
> >
> > --- "WLMPilot" wrote:
> > > I am trying to figure out a way to create a work schedule for employees via
> > > EXCEL.
> > > I want the scheduler to use one workbook, defining certain info like
> > > beginning date of schedule and actually creating the schedule (indicating
> > > who is working when), then create a new workbook with the schedule in it.
> > >
> > > 1) Can this be done?
> > >
> > > 2) If it can be done, can you provide sample coding that transfers the
> > > schedule from the original workbook to the new workbook that is sent to
> > > employees?
|