Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 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 March 26th, 2007, 01:42 PM
Authorized User
 
Join Date: Mar 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jgrant
Default copy sheets

I have this excel file that I have created. I wanted to set it up to be multi-user friendly. So essentially what i have done was at startup, i ask for a user name and password. Then the code runs through a worksheet and checks for user name and password. If the password cannot be verified it copies a worksheet for the user to fill out. But for some reason I keep getting an error on the copy worksheet routine. Here is the code:

Private Sub CopySheets()
Dim wsh As Worksheet
ActiveWorkbook.Sheets("SRC").Copy _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)
Set wsh = ActiveSheet
wsh.Name = userName & " SRC"

The error im getting is a Run-time error '1004', Application-defined or object-defined error.

I have tried using the code several different ways but I have not been able to get it to work. Can anyone give me a reccomendation?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two excel sheets nbkn8ct Excel VBA 5 August 28th, 2009 05:20 PM
Premade stlye sheets shawn17 Beginning VB 6 0 July 22nd, 2007 04:26 PM
Using Defined Names From Sheets RollingWoodFarm Excel VBA 0 September 22nd, 2006 04:14 PM
Macro to count the no. of sheets sunny76 Excel VBA 2 August 19th, 2005 02:10 AM





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