Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy a sheet in an Excel workbook
Message
From
09/06/1999 13:00:19
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Copy a sheet in an Excel workbook
Miscellaneous
Thread ID:
00227990
Message ID:
00227990
Views:
86
I am trying to find the proper syntax for creating a copy of a sheet in an Excel workbook. The VBAXL8.HLP file gives examples as:

Worksheets("Sheet1").Copy after := Worksheets("Sheet3")

but I cannot get that to work. I have tried many variations such as:

oleapp.Worksheets("Sheet1").Copy after oleapp.Worksheets("Sheet3")
oleapp.Worksheets("Sheet1").Copy after Worksheets("Sheet3")
oleapp.Worksheets("Sheet1").Copy('after Worksheets("Sheet3")')
oleapp.Worksheets("Sheet1").Copy(after Worksheets("Sheet3"))
oleapp.Worksheets("Sheet1").Copy('after oleapp.Worksheets("Sheet3")')
oleapp.Worksheets("Sheet1").Copy 'after oleapp.Worksheets("Sheet3")'
oleapp.Worksheets("Sheet1").Copy after 'oleapp.Worksheets("Sheet3")'
oleapp.Worksheets("Sheet1").Copy 'after :=Worksheets("Sheet3")'
oleapp.Worksheets("Sheet1").Copy 'after "Sheet3"'
oleapp.Worksheets("Sheet1").Copy after "Sheet3"

The best I have found is that the copy is made but placed in a new workbook. I need to be able to create the copy in the same workbook.
Mark Johns
Next
Reply
Map
View

Click here to load this message in the networking platform