Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default run-time error

I am creating a form that when you save it it will create
a new sheet in a seperate excel file with the name of the
sheet being one of the user entries....i am having two
problems. the first is that when the user begins to enter
the name (which will be the name of the tab) the other
file opens and every letter that is typed the message
saying file is already open. reopening will cause any
changes to be discarded. reopen anywa? or something like
that. The second is that after the name is entered when i
click the command button to save it i get a run-time error
(9) subscript out of range and when i debug it goes to the
line that references the sheet. the code to create the
sheet is:

Workbooks.Open Filename:="C:\Documents and
Settings\ddd\Desktop\temp.xls"
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(1)
Sheets("Template (2)").Name = "" & TextBox1.Value & ""
Range("A1:P1").Select
created = True

and the code that references it is

Workbooks.Open Filename:="C:\Documents and
Settings\ddd\Desktop\temp.xls"

Sheets("" & Candidate & "").Select
Cells(1, 2).Select


Any thoughts? Thanks a lot
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default run-time error

Hi Jimmy,

the first is that when the user begins to enter
the name (which will be the name of the tab) the other
file opens and every letter that is typed the message
saying file is already open. reopening will cause any
changes to be discarded. reopen anywa? or something like
that.


Don't put the code in the EditBox_Change event! Leave it until the
button is clicked.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Receiving run-time error only part of the time [email protected] Excel Discussion (Misc queries) 0 August 11th 07 12:01 AM
run-time error '91'-Close Button error ASCO IS Help Excel Discussion (Misc queries) 1 May 8th 06 04:25 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM


All times are GMT +1. The time now is 12:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"