View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Thor[_2_] Thor[_2_] is offline
external usenet poster
 
Posts: 5
Default VBA reference error

I have an application which works fine in my home environment. When I
run it at work though I get the following error message;

Run-time error '1004':

'Programmatic access to Visual Basic Project not trusted'

after the follwing routine;

With Application.VBE.ActiveVBProject.References
On Error Resume Next
.AddFromFile Filename:="msoutl9.olb"
If Err Then .AddFromFile Filename:="msoutl.olb"
On Error GoTo 0
End With

It stops on the first row.

Protection of the project is not activated (password written but not in
'use'. When I remove the password the error message changes to the
following;

'<Method 'VBE' of object '_application' failed'

Again it stops on the first row.

At home I use Excel 2000 9.0 in a W2000-environment and at work Excel
10.0.

What I want to handle is to open the reference in Excel to Outlook in
case it is not already open.

Another 'error' I encounter at work is that when I open the file I get
the following message;

'Excel encountered an error and had to remove some formatting to avoid
corrupting the workbook. Please re-check your formatting carefully.'

Is there any way to find out where to find the incorrect formatting? Is
there perhaps a connection between the two errors above and formatting
error?

If necessary I can forward the entire file. I might need to 'clean it
up' a litle since it is partly in Swedish. Any help is much appreciated.

Best regards,

Thor



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!