LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Playing around with Syntax

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


 
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
Detecting the actual playing or NOT playing of a WAV file Bajbaj Excel Discussion (Misc queries) 0 October 24th 07 09:16 PM
Games not playing in Excel [email protected] Excel Discussion (Misc queries) 0 January 29th 07 10:32 PM
playing sound??? tess457[_6_] Excel Programming 2 October 20th 04 11:50 AM
Playing music Naveen Sukhramani Excel Programming 2 July 26th 04 02:20 PM
Playing a .wav when a cell's value changes Jimm L Excel Programming 3 January 29th 04 04:10 PM


All times are GMT +1. The time now is 12:24 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"