Welcome to the forum!

Please start a new thread if you are not contributing to an active thread and need your own help.

When posting a new thread and parts like the MergePDFs() routine is used, feel free to add a link to a post like this one that might be relevant. For new users, just say what thread number, e.g. 47310.

When posting code, click the # icon to insert the code tags and paste between them.

You can always attach a file so we can check things like references and such. Click the "Go Advanced" button to get the paperclip icon to do that. Post a simple file that isolates the problem if possible. The more you help us, the better and faster help you will get.

For your issue, I am guessing maybe you have a conflict with your Constant variables. The MergePDFs() routine can easily be modified to include input parameters rather than Constant variables. Use F8 in the Visual Basic Editor (VBE) to step through your code one line at a time to debug. And/or, use Debug.Print to print intermediate results to the Immediate window during a run. Of course that does not help for a Compile issue. Compiling before a run is important.

Without seeing all of your code, I am guessing maybe you did not include the MergePDFs() sub as another possible cause.

Another cause can be the reference to the Adobe Acrobat object and registration of the object. Again, seeing an attachment can tell us that tell, if we have that object as well of course.

Tip: Other parts of your code could use some tweaking. I noticed that you used Preserve. That can be used in building of the file names array rather than defining a huge array. There are other neat ways to do that sort of thing too. That is fodder for another thread of course.