Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default not able to set a sheet name having two dots.

Can any one help? When i try to put this code in excel 2003 and run, i get "Subscript out of range" runtime error 9. But in 2000 it was not there.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tmpWB As Workbook
Set tmpWB = Workbooks.Open("c:\208.Face-Centered_CCD.table", 0, True, 2)
Dim tmpSheet As New Worksheet
Dim s As String
s = Left("208.Face-Centered_CCD.table", 31)
MsgBox s
Set tmpSheet = Sheets(Left("208.Face-Centered_CCD.table", 31))
MsgBox tmpSheet.Name
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default not able to set a sheet name having two dots.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tmpWB As Workbook
Set tmpWB = Workbooks.Open("c:\208.Face-Centered_CCD.table", 0, True, 2)
Dim tmpSheet As Worksheet
Dim s As String
s = "208.Face-Centered_CCD.table"
MsgBox s
On Error Resume Next
Set tmpSheet = Sheets(s)
On Error goto 0
if tmpSheet is nothing then
Msgbox "No sheet named " & s
else
MsgBox tmpSheet.Name
End if
End Sub

--
Regards,
Tom Ogilvy

"Laks" wrote in message
...
Can any one help? When i try to put this code in excel 2003 and run, i get

"Subscript out of range" runtime error 9. But in 2000 it was not there.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tmpWB As Workbook
Set tmpWB = Workbooks.Open("c:\208.Face-Centered_CCD.table", 0, True,

2)
Dim tmpSheet As New Worksheet
Dim s As String
s = Left("208.Face-Centered_CCD.table", 31)
MsgBox s
Set tmpSheet = Sheets(Left("208.Face-Centered_CCD.table", 31))
MsgBox tmpSheet.Name
End Sub



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
Leading dots...trailing dots Josh O. Excel Discussion (Misc queries) 2 January 31st 08 06:22 PM
Leader Dots Between Cells Ty New Users to Excel 11 December 22nd 07 04:38 AM
leading dots milfordatty Excel Discussion (Misc queries) 7 August 29th 07 05:26 PM
Change dots to commas!! Andreas Excel Discussion (Misc queries) 1 November 18th 06 12:55 AM
dots instead of grid lines wrexx Excel Worksheet Functions 1 February 1st 05 11:52 PM


All times are GMT +1. The time now is 08:45 PM.

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"