Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Error Loading Add-In

I have an add-in loaded all the time that checks any opened workbook name
for a specific string. The below code does this except when excel is opened
with no workbook (i.e. from Programs Menu). This code resides in the
App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when excel
opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0 Then
MsgBox "it is our file"
Call CreateMenu
End If


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Error Loading Add-In

actually i've discovered my code in my previous post is failing even when i
open a workbook.

error is

Object variable or With block variable not set

what's wrong with that syntax?


"scott" wrote in message
...
I have an add-in loaded all the time that checks any opened workbook name
for a specific string. The below code does this except when excel is opened
with no workbook (i.e. from Programs Menu). This code resides in the
App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when
excel opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the
error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0 Then
MsgBox "it is our file"
Call CreateMenu
End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default Error Loading Add-In

How about putting:

If Not ActiveWorkbook Is Nothing Then
...
End if

around your If InStr statement?

josh



"scott" wrote in message
...
actually i've discovered my code in my previous post is failing even when
i open a workbook.

error is

Object variable or With block variable not set

what's wrong with that syntax?


"scott" wrote in message
...
I have an add-in loaded all the time that checks any opened workbook name
for a specific string. The below code does this except when excel is
opened with no workbook (i.e. from Programs Menu). This code resides in
the App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when
excel opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the
error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Error Loading Add-In

If I open a file named "History by Length.xls", shouldn't my below code
fire?

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If


"Josh Sale" <jsale@tril dot cod wrote in message
...
How about putting:

If Not ActiveWorkbook Is Nothing Then
...
End if

around your If InStr statement?

josh



"scott" wrote in message
...
actually i've discovered my code in my previous post is failing even when
i open a workbook.

error is

Object variable or With block variable not set

what's wrong with that syntax?


"scott" wrote in message
...
I have an add-in loaded all the time that checks any opened workbook name
for a specific string. The below code does this except when excel is
opened with no workbook (i.e. from Programs Menu). This code resides in
the App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when
excel opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the
error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default Error Loading Add-In

I'm just trying to help you avoid the error you said you were getting ... I
haven't followed the whole thread.



"scott" wrote in message
...
If I open a file named "History by Length.xls", shouldn't my below code
fire?

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If


"Josh Sale" <jsale@tril dot cod wrote in message
...
How about putting:

If Not ActiveWorkbook Is Nothing Then
...
End if

around your If InStr statement?

josh



"scott" wrote in message
...
actually i've discovered my code in my previous post is failing even
when i open a workbook.

error is

Object variable or With block variable not set

what's wrong with that syntax?


"scott" wrote in message
...
I have an add-in loaded all the time that checks any opened workbook
name for a specific string. The below code does this except when excel
is opened with no workbook (i.e. from Programs Menu). This code resides
in the App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when
excel opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the
error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Error Loading Add-In

If my workbook is named "My Book.xls" why doesn't the INSTR function work
below?

Dim bk As Workbook

For Each bk In Application.Workbooks

If InStr("My Book", bk.Name) 0 Then
MsgBox "it is our file"
End If

Next



"Josh Sale" <jsale@tril dot cod wrote in message
...
I'm just trying to help you avoid the error you said you were getting ...
I haven't followed the whole thread.



"scott" wrote in message
...
If I open a file named "History by Length.xls", shouldn't my below code
fire?

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If


"Josh Sale" <jsale@tril dot cod wrote in message
...
How about putting:

If Not ActiveWorkbook Is Nothing Then
...
End if

around your If InStr statement?

josh



"scott" wrote in message
...
actually i've discovered my code in my previous post is failing even
when i open a workbook.

error is

Object variable or With block variable not set

what's wrong with that syntax?


"scott" wrote in message
...
I have an add-in loaded all the time that checks any opened workbook
name for a specific string. The below code does this except when excel
is opened with no workbook (i.e. from Programs Menu). This code resides
in the App_WorkbookOpen event in the add-in.

How can I suppress the error generated when no workbook is opened when
excel opens and is loading my add-in with below code? The
Application.ActiveWorkbook.Name object is null and that's causing the
error.

If InStr("History by Length", Application.ActiveWorkbook.Name) 0
Then
MsgBox "it is our file"
Call CreateMenu
End If











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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - error saving file & error loading dll TinaF Excel Discussion (Misc queries) 0 July 1st 09 01:49 PM
Error Loading DLL chris Excel Discussion (Misc queries) 0 June 26th 08 02:03 PM
Error loading DLL Bhuktar S[_9_] Excel Programming 0 September 23rd 04 12:44 PM
Error Loading DLL Peter[_36_] Excel Programming 2 January 16th 04 01:32 PM
Error Loading dll Jeffrey Excel Programming 1 October 21st 03 10:29 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"