Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COPY MySheet ( Help!!)
Message
 
To
08/11/2000 13:51:54
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00439327
Message ID:
00439338
Views:
20
>I'm copying a "template" sheet within a workbook in order to make one sheet for each employee. I want to add a sheet called "Cindy" to the current workbook - either at the end (Sheets(Count)) or after some particular sheet.
>
>I have
lcSheetType = "Monthly"
>lcEmployee = "Cindy"
>oExcel.Sheets(lcSheetType).Copy()
which creates a new workbook and puts a sheet called "Montlhy" in it - but I want it to be in the current workbook! The docs say the syntax I need is
Worksheets("Sheet1").Copy after := Worksheets("Sheet3")
but I can't translate this into anything I can use.
>
>Help is appreciated!
Hi Cindy,

it is not a big deal. :)

If you try to substitute the parameter with worksheet name or number it does not work because it has to be an object reference:

A sample:

ox = createobject("excel.application")
ox.visible = .t.
oWorkbook =ox.ActiveWorkbook
obefore = oWorkBook.Sheets(2)
oWorkbook.Sheets(3).Copy(oBefore)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform