ByRef argument type mismatch in Excel VBA

I suspect you haven’t set up last_name properly in the caller. With the statement Worksheets(data_sheet).Range(“C2”).Value = ProcessString(last_name) this will only work if last_name is a string, i.e. appears in the caller somewhere. The reason for this is that VBA passes in variables by reference by default which means that the data types have to match exactly between caller and callee. Two fixes: … Read more

Recommended IDE for VBA

I use and recommend Rubberduck. Description from the website: Rubberduck is a very active open-source COM add-in project that integrates with the Visual Basic Editor to enable the features every programmer wants to have in their IDE. From unit testing to source control, from code inspections to refactorings, programming in VBA will never be the same.

check if a file is open in Python

I assume that you’re writing to the file, then close it (so the user can open it in Excel), and then, before re-opening it for append/write operations, you want to check that the file isn’t still open in Excel? This is how you could do that: