Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 17th, 2007, 04:10 PM
Registered User
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy worksheet to another workbook and rename it


I have been trying to Copy a worksheet into another workbook and rename it using macro. But while running it Gives me an error:
Run-time error '40036': Application-defined or object-defined error.

Any help will be appreciated.
Old August 19th, 2007, 11:38 PM
Registered User
Join Date: Aug 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

try something like this macro. the macro should be parked in the workbooks FROM WHICH the sheet is copied.

Sub test()

ActiveWorkbook.SaveAs "C:\Documents and Settings\VENKAT\My Documents\rv1.xls"
ThisWorkbook.Worksheets("sheet1").Copy before:=ActiveWorkbook.Worksheets("sheet1")

End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Worksheet into another workbook money Excel VBA 4 March 8th, 2007 05:17 AM
copy and rename red_fiesta Classic ASP Professional 1 November 8th, 2006 11:00 AM
NEWBIE: Copy and Rename arthurb XSLT 3 April 12th, 2006 01:00 PM
Copy a worksheet range to a new workbook cej2583 Excel VBA 2 March 14th, 2006 11:55 PM
Find Unknown Worksheet Names in an Excel Workbook bcarmen VB.NET 2002/2003 Basics 1 March 3rd, 2005 12:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.