jullit31
jullit31

Reputation: 27

Access: Run time error 424 with ActiveWorkbook.path

I'm trying to open the directory that contains my Access database using this code

Dim path As String
path = ActiveWorkbook.path & "\"
Shell "cmd /C start """" /max """ & path & """", vbHide

as suggested here by @AnorZaken.

The second line however raises a run time error "424 object required". When I use some static path (i.e. path = "C:\") everything works fine.

Upvotes: 1

Views: 636

Answers (1)

HansUp
HansUp

Reputation: 97101

ActiveWorkbook is for Excel. In Access, use CurrentProject

'path = ActiveWorkbook.path & "\"
path = CurrentProject.Path & "\"

Upvotes: 2

Related Questions