• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Late Binding of Word in Excel Macro

OK, I have this macro that I created in Excel 2010. The issue is I have used Object References and that is causing issues with Office 2007 users. So I am trying to late bind Word so I do not have to use the Object Reference.

I have tried to get late binding to work but keep haging different issues.

I get Run-time error '5861': 'Name' is a read only property. on this line of code: wdDoc = Dir(Path & "\*.doc")

Could some please help me understand what is incorect in my macro?

Thanks a lot. I am still new at VBA.
 

Attachments

  • Word Extraction Program Tax V2.xlsm
    30.4 KB · Views: 1
Hi ,

The problem is that the Dir function returns a String type variable ; instead of assigning this string to a variable which is of type Object , you need to declare a String type variable , as in :

Dim file_name as String

and then assign to it the result of the Dir function , as in :

file_name = Dir(Path & "\*.doc")

Narayan
 
Back
Top