Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Weird Excel problem

Hi

I'm using VBScript to open an excel workbook and get some values from
the different worksheets. The problem is that one of the worksheets
creates an "Unknown Runtime Error".

The line on which the error arises is:
strTotalDays = xlWB.Range("C22")

After further investigation, it appears ANYTHING on this sheet seems
to create an error. There is also a hidden spreadsheet just before
that sheet - not sure if that has a problem. If I do the following:
For each objTemp in xlWB.Worksheets
msgbox objTemp.Name
Next

it will msgbox the names of all the sheets including the hidden sheet
and excluding the sheet I want!

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Weird Excel problem

Hi Sean,
strTotalDays = xlWB.Range("C22")
Your implying a WORKBOOK object. Workbooks don't have ranges.
Worksheets or sheets do.

Try strTotalDays = xlWB.sheets(sheetname).Range("C22")
Or strTotalDays = xlWB.sheets("sheet1").Range("C22")

--

John
johnf202 at hotmail dot com


"Sean" wrote in message
om...
Hi

I'm using VBScript to open an excel workbook and get some values from
the different worksheets. The problem is that one of the worksheets
creates an "Unknown Runtime Error".

The line on which the error arises is:
strTotalDays = xlWB.Range("C22")

After further investigation, it appears ANYTHING on this sheet seems
to create an error. There is also a hidden spreadsheet just before
that sheet - not sure if that has a problem. If I do the following:
For each objTemp in xlWB.Worksheets
msgbox objTemp.Name
Next

it will msgbox the names of all the sheets including the hidden sheet
and excluding the sheet I want!

Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Weird Excel problem

Hi

Sorry, my mistake (typo).

My code is actually:
Set xlWS = xlWB.Sheets("SPLS PI Data")
strTotalContractedDays = xlWS.Range("C22")

The second line (Range) gives me the error.

Sure as hell, I've tried everything. On Excel Version 10 it actually
works fine, but we've got Version 11 installed and need to use it.

I really don't know how to get around it. It is literally confusing
the Worksheet name with a hidden worksheet, but if I try using the
hidden worksheet name, or the index or either sheet, or anything else,
I can't get a reference to the (visible) worksheet that I need.

Any ideas?
Thanks
Sean



"jaf" wrote in message ...
Hi Sean,
strTotalDays = xlWB.Range("C22")
Your implying a WORKBOOK object. Workbooks don't have ranges.
Worksheets or sheets do.

Try strTotalDays = xlWB.sheets(sheetname).Range("C22")
Or strTotalDays = xlWB.sheets("sheet1").Range("C22")

--

John
johnf202 at hotmail dot com


"Sean" wrote in message
om...
Hi

I'm using VBScript to open an excel workbook and get some values from
the different worksheets. The problem is that one of the worksheets
creates an "Unknown Runtime Error".

The line on which the error arises is:
strTotalDays = xlWB.Range("C22")

After further investigation, it appears ANYTHING on this sheet seems
to create an error. There is also a hidden spreadsheet just before
that sheet - not sure if that has a problem. If I do the following:
For each objTemp in xlWB.Worksheets
msgbox objTemp.Name
Next

it will msgbox the names of all the sheets including the hidden sheet
and excluding the sheet I want!

Any ideas?

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
Weird Excel 2003 macro problem LindaB789 Excel Discussion (Misc queries) 2 July 30th 09 08:40 PM
Excel 2007 Weird Image problem [email protected] Excel Discussion (Misc queries) 0 June 29th 07 10:28 PM
Weird problem with Excel 2000...Worksheets disappearing in a shared Excel file BrianL_SF Excel Discussion (Misc queries) 2 October 10th 06 08:27 PM
Weird Excel date formatting problem Ian D New Users to Excel 2 October 21st 05 03:30 PM
WEIRD Excel problem when saving.... jcolon68 Excel Discussion (Misc queries) 1 September 14th 05 05:07 PM


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

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

About Us

"It's about Microsoft Excel"