Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Tamar Granor
  Where is Tamar Granor?
 Elkins Park
 Pennsylvania - United States
 Tamar Granor
 To: Rogerio Pessanha
  Where is Rogerio Pessanha?
 Campos dos Goytacazes
 Brazil
 Rogerio Pessanha
Subject: RE: Word Automation with Database
Thread ID: 470224 Message ID: 470227 # Views: 69 # Ratings: 0
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Friday, November 22, 2019 10:52:00 PM         
   



> I am trying to automate the process of creating documents by taking data from my bank via WORD.
> I have windows 7, word starter 10.
> I looked for some examples:
> http://www.tomorrowssolutionsllc.com/ConferenceSessions/Automating%20Microsoft%20Word.PDF
>
> https://docs.microsoft.com/en-us/office/vba/api/word.range.style
>
> http://portal.dfpug.de/dfpug/Dokumente/Partner/Hentzenwerke/Microsoft%20Office%20Automation%20with%20Visual%20FoxPro%20Chapter%2006.pdf
>
>
> And on many attempts, the VFP issues error message.
>
> In this code :
>
> oRange = oDocument.Range()
> WITH oRange
> .Style = oDocument.Styles[ "Heading 1" ]
>
> this error message "OLE IDISPATCH EXCEPTION CODE 0 FROM MICROSOFT WORD: COLLECTION REQUESTED MEMBER DOES NOT EXIST"
>

It sounds like you don't have a style named "Heading 1" in the document. I've never worked with a version of Word that isn't in US English. Are style names in non-US editions in English or in the local language?

If that's not the issue, are you using a custom template or the default template? If custom, does your template have a Heading 1 style?

Tamar

ENTIRE THREAD

Word Automation with Database Posted by Rogerio Pessanha @ 11/22/2019 6:42:50 PM
RE: Word Automation with Database Posted by Tamar Granor @ 11/22/2019 10:52:00 PM
RE: Word Automation with Database Posted by Rogerio Pessanha @ 11/25/2019 1:38:00 PM
RE: Word Automation with Database Posted by Cetin Basoz @ 11/25/2019 1:52:09 PM
RE: Word Automation with Database Posted by Rogerio Pessanha @ 11/25/2019 1:38:53 PM