View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Hari Prasadh Hari Prasadh is offline
external usenet poster
 
Posts: 63
Default Playing around with Syntax

Hi Ben,

Thnx for the reply.

Actually my intention was not to change the Name of the workbook. Rather I
want to store the name of the workbook in a String such as --
NameOfOSWorkbook -- and then through out my code whenever I wanted to refer
the workbook I wanted to use the name of the string -- NameOfOSWorkbook --
rather than using the actual name of the workbook.

This way if the workbook name changes I would have to change the code at one
line, which is to change the right hand side of the code --
NameOfOSWorkbook.Name = "Open end data (OS).xls" --

Ok, now I understand that NameOfOSWorkbook.Name is erroneous because it
implies changing name of the workbook.

So, does that mean the following is the ONLY way to reference a workbook
(NameOfOSWorkbook). Or is there a more efficient method?

Dim sh As Worksheet
Dim NameOfOSWorkbook As String
Dim NameOfOEWorkbook As String
NameOfOSWorkbook = "Open end data (OS).xls"
NameOfOEWorkbook = "Open end data (OE).xls"
For Each sh In Workbooks(NameOfOSWorkbook).Worksheets
...
...
...
Call readingarrayofuniquewords(sh.name)
...
...
...
Next sh



Thanks a lot,
Hari
India