Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Help please....

I have the following code and I get the following error"
Object variable or With block variable not set (Error 91) on the line:
Set c = xlApp.Worksheets("master").Find("555)111-2222", LookIn:=xlValues)

What is going one?
I am calling this from OUTLOOK.

Here is my code:

Private Function WorkbookIsOpen1(wbname) As Boolean 'wbname will be passed
once I get te resr working...

Dim tempx As Object
Dim c As Range
Dim b As Range
Dim xlSheet As Excel.Worksheet

MsgBox " WorkbookIsOpen1"

Set tempx = GetObject("C:\current.xls")
MsgBox " WorkbookIsOpen1: " & Err

If Err = 0 Then
WorkbookIsOpen1 = True
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
tempx.Worksheets("master").Activate
Set c = xlApp.Worksheets("master").Find("(555)111-2222",
LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Offset(0, -3)
Else
MsgBox "Not found..."
End If
Else
WorkbookIsOpen1 = False
MsgBox "error: " & Err
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
End If


End Function


Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Help please....

change these

tempx.Worksheets("master").Activate
Set c = xlApp.Worksheets("master").Find("(555)111-

2222",
LookIn:=xlValues)


to

SET xlSheet = tempx.Worksheets("master")
Set c = xlSheet.Cells..Find("(555)111-2222", _
LookIn:=xlValues)

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
I have the following code and I get the following error"
Object variable or With block variable not set (Error

91) on the line:
Set c = xlApp.Worksheets("master").Find("555)111-

2222", LookIn:=xlValues)

What is going one?
I am calling this from OUTLOOK.

Here is my code:

Private Function WorkbookIsOpen1(wbname) As

Boolean 'wbname will be passed
once I get te resr working...

Dim tempx As Object
Dim c As Range
Dim b As Range
Dim xlSheet As Excel.Worksheet

MsgBox " WorkbookIsOpen1"

Set tempx = GetObject("C:\current.xls")
MsgBox " WorkbookIsOpen1: " & Err

If Err = 0 Then
WorkbookIsOpen1 = True
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
tempx.Worksheets("master").Activate
Set c = xlApp.Worksheets("master").Find("(555)111-

2222",
LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Offset(0, -3)
Else
MsgBox "Not found..."
End If
Else
WorkbookIsOpen1 = False
MsgBox "error: " & Err
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
End If


End Function


Thanks


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help please....

Set c = xlSheet.Cells..Find("(555)111-2222", _
LookIn:=xlValues)

should only have one full stop/period between cells and find

Set c = xlSheet.Cells.Find("(555)111-2222", _
LookIn:=xlValues)

--
Regards,
Tom Ogilvy

Patrick Molloy wrote in message
...
change these

tempx.Worksheets("master").Activate
Set c = xlApp.Worksheets("master").Find("(555)111-

2222",
LookIn:=xlValues)


to

SET xlSheet = tempx.Worksheets("master")
Set c = xlSheet.Cells..Find("(555)111-2222", _
LookIn:=xlValues)

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
I have the following code and I get the following error"
Object variable or With block variable not set (Error

91) on the line:
Set c = xlApp.Worksheets("master").Find("555)111-

2222", LookIn:=xlValues)

What is going one?
I am calling this from OUTLOOK.

Here is my code:

Private Function WorkbookIsOpen1(wbname) As

Boolean 'wbname will be passed
once I get te resr working...

Dim tempx As Object
Dim c As Range
Dim b As Range
Dim xlSheet As Excel.Worksheet

MsgBox " WorkbookIsOpen1"

Set tempx = GetObject("C:\current.xls")
MsgBox " WorkbookIsOpen1: " & Err

If Err = 0 Then
WorkbookIsOpen1 = True
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
tempx.Worksheets("master").Activate
Set c = xlApp.Worksheets("master").Find("(555)111-

2222",
LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Offset(0, -3)
Else
MsgBox "Not found..."
End If
Else
WorkbookIsOpen1 = False
MsgBox "error: " & Err
MsgBox "WorkbookIsOpen: " & WorkbookIsOpen1
End If


End Function


Thanks


.



Reply
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



All times are GMT +1. The time now is 11:45 AM.

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"