Good Morning,
I have written some code for a friend of my and we have run into a problem. I use 2003 and he uses 2007. Everything works fine in 2003, but we have had to modify a few things when we moved everything to 2007. We have run into a problem we just cannot seem to solve so I thought I would post it and see if there is something simple I am over looking.
Below is the small section of code I am having problems with.
Dim wsData As Worksheet, wsReadings As Worksheet, wsError As Worksheet
Dim wsApt As Worksheet, wsRentRoll As Worksheet
Set wsData = Workbooks("Water Meter Billing.xlsm").Sheets("Data")
If WorkbookIsOpen("TC Rent Roll.xlsm") <> True Then
Workbooks.Open Filename:=C:/Two Mile/Water Meter/Timbercreek/TC Rent Roll.xlsm
End If
Set wsRentRoll = Workbooks("TC Rent Roll.xlsm").Sheets(1)
Set wsApt = Workbooks("Water Meter Billing.xlsm").Sheets(wsData.Cells(1, 4).Value)
Set wsReadings = Workbooks("Water Meter Billing.xlsm").Sheets("Readings")
Set wsError = Workbooks("Water Meter Billing.xlsm").Sheets("Errors")
The problem arises with
If WorkbookIsOpen("TC Rent Roll.xlsm") <> True Then
and
Set wsRentRoll = Workbooks("TC Rent Roll.xlsm").Sheets(1)
The IF statement is just checking to see if the file is open and if it is not, it opens it. Neither the IF statement or the Set statement are working for TC Rent Roll.xlsm. All the other Set statements work fine.
TC Rent Roll.xlsm exists and it is in the proper location for the program to find it. I am completely stumped as to why it does not like that file. Can any of you see something that looks incorrect.
Bookmarks