LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
jh jh is offline
external usenet poster
 
Posts: 9
Default Trust access to the VBA project: Excel bug?, workaround required.

I'm fairly sure this is a VBA bug (comments welcome) and need a
workaround.

In Excel 2007 'm using the the function below in an add-in to return
the access oft the VBA project. It appears to work correctly.

Private Function IsVBProjectAvailable() As Boolean
Dim lngAccessTest As Long

On Error Resume Next
lngAccessTest = ThisWorkbook.VBProject.VBComponents.Count

If lngAccessTest 0 Then
IsVBProjectAvailable = True
Else
IsVBProjectAvailable = False
End If
End Function


....UNTIL you open a workbook containing macros. At that point unless
you ENABLE the macros the function then returns FALSE. The reason I'm
fairly sure its a bug is that a) it's the wrong answer and b) if you
then open the VBE (have it closed before you start, and don't do
anything except open it) the function then correctly returns TRUE

Any comments or suggestions for a workaround, or perhaps (hopefully)
I'm missing something obvious??!!

Thanks
John
 
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. Trust Access to VBA Project Checked, still not truste Barb Reinhardt Excel Programming 18 March 12th 09 10:26 PM
Trust Access to Visual Basic Project tcb Excel Programming 0 January 9th 08 06:39 PM
Trust Access to Visual Basic Project - Access to Excel and back tcb Excel Programming 0 January 8th 08 02:43 AM
Trust Access to Visual Basic Project Farah[_7_] Excel Programming 0 November 7th 05 01:17 PM
Trust access to visual basic project in XP systems kasi Excel Discussion (Misc queries) 5 October 13th 05 01:32 PM


All times are GMT +1. The time now is 06:27 AM.

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"