Fill Word document from Excel (not mail merge)

  • I can do a mailmerge from Excel via VBA so this was meant to be easy. I have an Excel sheet with data which I want to transfer to a Word document. But nothing I have tried so far has worked and I have scoured the internet high and low for code. - The code opens the Word document but from then on nothing happens. Error Message says Object doesn't support this property or method. Which I think refers to the With block. I have tried other methods but nothing works!

    Any other suggestions would be appreciated. Thanks.

    (Other things the macro is meant to do are read list of files in directory and add in, some variable content and then save in specified folder with specified name.)

  • The ActiveDocument object does not have an 'Item' property which is probably the cause of the error. That's all I can say based on the information in your message. Most likely you are replacing information in predefined bookmarks but if you don't say then it's difficult to answer.

    Also this line probably errors too unless 'Christine' is some sort object or variable in scope.

    If sh1.[B3] = Christine Then
  • Hi XenoCode

    All solved! You put me on the right track with the non-existent property. I had FormFields with a named bookmark so it didn't like the bookmarks property, I had to use the FormFields property.

    I also managed to insert all published docs in the folder by writing it directly in that piece of code.

    Next, I'll update the footer as well and I'll be going home at lunch time from now on :)

    Below the code as it's now, all pretty and working. Thanks for your help.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!