MBlackburn
MBlackburn

Reputation: 117

Assign VBA code for a button to run off of workbook

I have a workbook with an object button that I've created called "Create New User". I've assigned the macro from "This Workbook" called "createnewuser".

However, if I send the workbook to someone and/or I create a copy of the workbook the button fails when clicked as it's looking for the file-path based on my NTID/etc.

How can I set the macro(s) so that they run based off of the workbook and not based off of my NTID/file-path/etc?

Upvotes: 0

Views: 193

Answers (1)

shA.t
shA.t

Reputation: 16958

You can use this property:

Workbook.Path Property like this: ActiveWorkbook.Path

Returns a String that represents the complete path to the workbook/file that this workbook object represents.

Upvotes: 1

Related Questions