![]() (You will need to set a reference if the compiler complains about that declaration.)Īside from that, I still don't understand why you're getting an "Invalid procedure call or argument" error. Also, change the declaration for rs to: Dim rs As DAO.Recordset I don't see how this contributes to your error, but I would discard the CreateObject("ADODB.Recordset") line anyway. ![]() ![]() However, since rs was declared as an object, VBA doesn't care that you first assigned an ADO recordset to it before you re-assign a DAO recordset to it. Set rs = CurrentDb.OpenRecordset("qryOutput")ĬurrentDb.OpenRecordset returns a DAO recordset rather than an ADO recordset. I don't understand why you're getting an error at TextFile.WriteLine. Changing the folder to one which exists, and where I have full permission, allows the code to run without error. So your code gives me error #76, "Path not found", on the CreateTextFile line. ![]() if based on the current month, if there is no file, the file extracted will be based on the previous month latest file. I don't have that folder, C:\Users\Documents, on my system. Error: run time error 5 invalid procedure call or argument when VBA is executed I would like to extract the latest excel file based on the current month from the filepath. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |