H
Hari Prasadh
Hi,
Some problem with syntax below.
sub try()
dim sh as worksheet
Dim NameOfOSWorkbook As Workbook
Dim NameOfOEWorkbook As Workbook
NameOfOSWorkbook.Name = "Open end data (OS).xls"
NameOfOEWorkbook.Name = "Open end data (OE).xls"
For each sh in NameOfOSWorkbook
...
...
...
Call readingarrayofuniquewords(sh)
...
...
...
Next sh
End sub
Im getting -- Compile error : cant assign to read-only property-- at the
line -- NameOfOSWorkbook.Name = "Open end data (OS).xls"
Why am I getting the same. If possible please point out the flaw in my
understanding (When we could write a statement like --
activeworkbook.name -- then why not -- NameOfOSWorkbook.Name --
Basically I wanted to store a workbook's name in one place so that if it
changes I could change it at one place.
I have gotten around the above problem in another circuitous manner, given
below.
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)
...
...
...
Call readingarrayofuniquewords(sh)
...
...
...
Next sh
End sub
But now am getting -- compile error ByRef argument type mismatch -- in the
line Call readingarrayofuniquewords(sh). Basically I wanted to pass the name
of the worksheet sh. When I changed it to -- Call
readingarrayofuniquewords(sh.name) -- things were fine.
Is there a more efficient way to code the above (I keep doing things by
trial and error).
Thanks a lot,
Hari
India
Some problem with syntax below.
sub try()
dim sh as worksheet
Dim NameOfOSWorkbook As Workbook
Dim NameOfOEWorkbook As Workbook
NameOfOSWorkbook.Name = "Open end data (OS).xls"
NameOfOEWorkbook.Name = "Open end data (OE).xls"
For each sh in NameOfOSWorkbook
...
...
...
Call readingarrayofuniquewords(sh)
...
...
...
Next sh
End sub
Im getting -- Compile error : cant assign to read-only property-- at the
line -- NameOfOSWorkbook.Name = "Open end data (OS).xls"
Why am I getting the same. If possible please point out the flaw in my
understanding (When we could write a statement like --
activeworkbook.name -- then why not -- NameOfOSWorkbook.Name --
Basically I wanted to store a workbook's name in one place so that if it
changes I could change it at one place.
I have gotten around the above problem in another circuitous manner, given
below.
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)
...
...
...
Call readingarrayofuniquewords(sh)
...
...
...
Next sh
End sub
But now am getting -- compile error ByRef argument type mismatch -- in the
line Call readingarrayofuniquewords(sh). Basically I wanted to pass the name
of the worksheet sh. When I changed it to -- Call
readingarrayofuniquewords(sh.name) -- things were fine.
Is there a more efficient way to code the above (I keep doing things by
trial and error).
Thanks a lot,
Hari
India