# The user of my Excel workbook with VBA



## Eric Penfold (Wednesday at 10:38 AM)

When the user tries to use the workbook it says "Can`t find Project or Library"??
Why is this??

This is where is shows an error


```
#If VBA7 Then
    Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
        ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
        ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
#Else
    Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
                                      (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
                                       ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#End If
Const SW_HIDE            As Long = 0&
```


----------



## RoryA (Wednesday at 10:41 AM)

Are you sure that's where the error is? That doesn't really make sense for that error message.


----------



## Eric Penfold (Thursday at 3:05 AM)

Could i send my workbook to you. 
Problem is it works fine with my PC then on the users one it does not work. 
Maybe if i send it to you it might highlight the issue.


----------



## RoryA (Thursday at 3:59 AM)

Before we do that, what references do you have set in the workbook's project (Tools - References in the VB Editor)?


----------



## Eric Penfold (Thursday at 4:11 AM)

I have all the Microsoft Object library's ticked &
OLE Automation
Microsoft Shell Controls & Automation
Microsoft Scripting runtime ticked


----------



## Jaafar Tribak (Thursday at 5:00 AM)

Just a thought. Maybe, in the other PC, the "Microsoft Shell Controls & Automation" library is marked as Missing in Tools\References and will need to be resolved (unticked).

I use WIN x64bit and the Shell32.dll file is located in the Windows\SysWow64 folder (_not_ in the Windows\System32 as one would expect) ... I would check in both locations.

Also, note that calling the _ShellExecute_ api function in code, doesn't need an explicit reference to the Microsoft Shell Controls & Automation library.


----------



## Eric Penfold (Thursday at 5:24 AM)

Shall i send it to you sorry getting a bit stuck on this??


----------



## RoryA (Thursday at 6:19 AM)

If you uncheck the Shell controls reference, does the code still work on your machine?


----------



## Eric Penfold (Thursday at 9:29 AM)

Seems that when you untick the shell control it won`t print.


----------



## RoryA (Thursday at 9:57 AM)

How are you printing? There shouldn't be any link between the two.


----------



## Eric Penfold (Wednesday at 10:38 AM)

When the user tries to use the workbook it says "Can`t find Project or Library"??
Why is this??

This is where is shows an error


```
#If VBA7 Then
    Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
        ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
        ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
#Else
    Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
                                      (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
                                       ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#End If
Const SW_HIDE            As Long = 0&
```


----------



## Eric Penfold (Thursday at 10:11 AM)

If that`s the case then I will knock it off


----------

