marcelita03
New Member
- Joined
- Jan 15, 2013
- Messages
- 38
Hello guys
I am so frustrated. 2 days trying to decipher this.
I have emailed a spreadsheet to all my internal customers and they all get the same error
"Run-time error 91: Object Variable or with block variable not set"
We all work on Excel 2010... so I don't think that's the problem
When the file opens, a Open_Workbook Macro runs
The error is in the line "Set Blank = sourceBook.Sheets("Blank")" but if I remove that it error in the next line...and in the next...and in the next
I don't get it, it works perfectly when I run it in my PC.
What is more puzzling....
When I take my spreadsheet and I e-mail as attachment to myself and I open it... I get the same error my customers get... so it's definitively not an Excel version issue...
After googling the issue extensively I am thinking now... maybe it has something to do with the fact that the e-mail changes the file to a "Read Only" and even after enabling editing on the file out of that e-mail there is something that is forever changed in the file extension or whatever and that prevents any "ActiveWorbook" reference from working?
Please help
I am so frustrated. 2 days trying to decipher this.
I have emailed a spreadsheet to all my internal customers and they all get the same error
"Run-time error 91: Object Variable or with block variable not set"
We all work on Excel 2010... so I don't think that's the problem
When the file opens, a Open_Workbook Macro runs
Code:
Sub Workbook_Open()
Dim Sure As Integer
Dim sourceBook As Workbook
Dim Blank As Worksheet
Dim Current As Range
Set sourceBook = ActiveWorkbook
Set Blank = sourceBook.Sheets("Blank")
Set Accounts = sourceBook.Sheets("Accounts")
Set Current = Accounts.Range("l1")
Blank.Select
Sure = MsgBox("Click OK only to retrieve data for the first time this period (it might take a couple of minutes) otherwise click Cancel", vbOKCancel)
If Sure = 1 Then Filter Else
If Current.Value = True Then
Accounts.Select
Exit Sub
The error is in the line "Set Blank = sourceBook.Sheets("Blank")" but if I remove that it error in the next line...and in the next...and in the next
I don't get it, it works perfectly when I run it in my PC.
What is more puzzling....
When I take my spreadsheet and I e-mail as attachment to myself and I open it... I get the same error my customers get... so it's definitively not an Excel version issue...
After googling the issue extensively I am thinking now... maybe it has something to do with the fact that the e-mail changes the file to a "Read Only" and even after enabling editing on the file out of that e-mail there is something that is forever changed in the file extension or whatever and that prevents any "ActiveWorbook" reference from working?
Please help