ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA reference error (https://www.excelbanter.com/excel-programming/287122-vba-reference-error.html)

Thor[_2_]

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!

Ron de Bruin

VBA reference error
 
Hi Thor

See this information from John Walkenbach
http://www.j-walk.com/ss/excel/tips/tip96.htm

About the Outlook reference:
You can use Binding for that
http://www.dicks-clicks.com/excel/olBinding.htm


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Thor" wrote in message ...
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!





All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com