Need help with error 40351 on one machine but not other

XDKYX

New Member
Joined
Oct 1, 2008
Messages
11
I am running the following code
Rich (BB code):
Option Explicit
Sub DESCRIPTION_SCRUBBER()
Dim rng As Range, strfirst As String, strletter As String, strnumber As String, LastRow As Long
Dim i As Long, Description As String, objAccess As Object, RowAnswer As String, RowMyNote As String
' START SELECT COLUMN MSGBOX
On Error Resume Next
Set rng = Application.InputBox("Select the top of your descriptions with the mouse, just below the header.", Type:=8)
On Error GoTo 0
If rng Is Nothing Then
    MsgBox "You cancelled"
    Exit Sub
End If
' END SELECT COLUMN MSGBOX
' START GET COLUMN LETTER
strfirst = IIf(Chr$(64 + rng.Column \ 26) = "@", "", Chr(64 + rng.Column \ 26))
strletter = strfirst & Chr$(64 + rng.Column Mod 26)
strnumber = rng.Row
' END GET COLUMN LETTER
' START MACRO WILL STOP AT ROW _? QUESTION
'Place your text here
RowMyNote = "Your top cell is " & strletter & strnumber & ", is that correct?"
'Display MessageBox
RowAnswer = MsgBox(RowMyNote, vbQuestion + vbYesNo, "???")
If RowAnswer = vbNo Then
    'Code for No button Press
    Exit Sub
Else
' END MACRO WILL STOP AT ROW _? QUESTION
' OPENS GREGG'S DESCRIPTION_CLEANER DATABASE
    Set objAccess = GetObject _
       ("\\canfsw03\groups3\PricingManagerMaintenance\Description_Cleaner.mdb")
        With objAccess
            .Visible = False
        End With
       
    LastRow = Range(strletter & "65536").End(xlUp).Row
        For i = LastRow To strnumber Step -1
            Description = objAccess.Run("RplASC_1", Range(strletter & i).Value)
            Range(strletter & i).Value = Description
        Next
' END IF FOR MACRO WILL STOP AT ROW _? QUESTION
End If
' END IF FOR MACRO WILL STOP AT ROW _? QUESTION
MsgBox "All Done!"
End Sub
and this code is being accessed through a network drive by putting a shortcut in the XLSTART folder of two different machines. The problem is that I get the following error
Run-time error ‘40351’:
Application-defined or object-defined error
on one machine and not on the other. I'm trying to figure out why. The error procedes to highlight this line of code
Rich (BB code):
Description = objAccess.Run("RplASC_1", Range(strletter & i).Value)
Any suggestions?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
The answer is always so easy, isn't it? I just figured this out. The reason it's not working on other machines is because the other machines are set up to block macros when they open Access. I set them up to allow macros and it works like a charm, thanks for the help all.
I may take some time and look into the digital signature thing but haven't quite made up my mind yet.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top