RE: Word automation

2014-04-08 Thread Richard Kaye
find a little time today I'll see if I can come up with a snippet that is not untested pseudo-code... -- rk -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Jim Harvey Sent: Monday, April 07, 2014 6:19 PM To: profoxt...@leafe.com Subject: Word

RE: Word automation

2014-04-08 Thread Jim Harvey
@leafe.com Subject: RE: Word automation I believe replacetext is for use by the Find object which is a probable cause for the error you're getting. You can use wildcards with the Find object, if that helps. In theory if the range references the cell, you could do something like this (untested pseudo

Word automation

2014-04-07 Thread Jim Harvey
Trying to figure out how to replace text in a cell in a table in a Word document. otable1 = oword.activedocument.tables[1] WITH otable1 .cell[1,1].range.insertbefore(newtest) .cell[1,1].range.insertafter(newtest) endwith This will add the text

Re: Word Automation

2011-11-09 Thread Desmond Lloyd
Good Morning, Was watching this with great interest. To heck with Word, automation is so painful If I may be so bold as to ask for a copy of the code if you wouldn't mind. That sounds like an infinitely more practical approach to filling out forms TIA, Desmond 8-) On 8 November

Re: Word Automation

2011-11-09 Thread Ted Roche
On Tue, Nov 8, 2011 at 4:48 PM, Jarvis, Matthew mat...@mckweb.com wrote: Go PDF Ted will prolly chime in here, but he helped me get started using the dynamic method of fillable PDF forms... O'Reilly publishes a book, PDF Hacks which I used for my solution. The author's sponsored link

Re: Word Automation

2011-11-09 Thread Desmond Lloyd
Thank You! Just looked at the links, very impressive. Can it be used with VFP? Regards, Desmond On 9 November 2011 09:54, Ted Roche tedro...@gmail.com wrote: On Tue, Nov 8, 2011 at 4:48 PM, Jarvis, Matthew mat...@mckweb.com wrote: Go PDF Ted will prolly chime in here, but he helped

Re: Word Automation

2011-11-09 Thread Ted Roche
On Wed, Nov 9, 2011 at 11:03 AM, Desmond Lloyd desmond.ll...@gmail.com wrote: Just looked at the links,  very impressive. Can it be used with VFP? I have not tried it, but you should be able to build up a command line (or even an entire batch file), shell out to DOS and execute it, capturing

Word Automation

2011-11-08 Thread Jeff Johnson
If I have an application that automates a Word 2003 document, will it work with Word 2007 or Word 2010 if my customer has those versions - on the same document? -- Jeff --- Jeff Johnson j...@san-dc.com (623) 582-0323 www.san-dc.com

RE: Word Automation

2011-11-08 Thread Richard Kaye
[mailto:profoxtech-boun...@leafe.com] On Behalf Of Jeff Johnson Sent: Tuesday, November 08, 2011 4:01 PM To: profoxt...@leafe.com Subject: Word Automation If I have an application that automates a Word 2003 document, will it work with Word 2007 or Word 2010 if my customer has those versions

Re: Word Automation

2011-11-08 Thread Ted Roche
On Tue, Nov 8, 2011 at 4:16 PM, Richard Kaye rk...@artfact.com wrote: Maybe... I've found that most of my automation code works without changing but the only way to know for sure is to test. (Did I just hear Ted?) rofl! It's hot button of mine. Several large applications that depended on

Re: Word Automation

2011-11-08 Thread Paul McNett
On 11/8/11 1:01 PM, Jeff Johnson wrote: If I have an application that automates a Word 2003 document, will it work with Word 2007 or Word 2010 if my customer has those versions - on the same document? Count on it not working. Be pleasantly surprised if it does work. Paul

Re: Word Automation

2011-11-08 Thread Jeff Johnson
Ok. Let me rephrase the question. I have government forms that I can get in fillable pdf or word documents. I need my application to fill out those forms. I would prefer to avoid Word at all cost. How can I accomplish this without using Word? I thought of creating an image on the report

RE: Word Automation

2011-11-08 Thread Jarvis, Matthew
Ok. Let me rephrase the question. I have government forms that I can get in fillable pdf or word documents. I need my application to fill out those forms. I would prefer to avoid Word at all cost. How can I accomplish this without using Word? Go PDF Ted will prolly chime in

Re: Word Automation

2011-11-08 Thread Jeff Johnson
You would be my hero if you would do that!!! I really need to fill these forms out in order to be able to do this application and automating Word was literally scaring me. I have avoided automation and active x at all costs and it has worked out well for me. Thank you so much! Jeff

Re: Word Automation

2011-11-08 Thread MB Software Solutions, LLC
On 11/8/2011 4:31 PM, Ted Roche wrote: It was one of my more painful experiences with Microsoft, and one that convinced me that MSFT wasn't serious about allowing their customer-developers to ship reliable and compatible enterprise-grade software. Nah...why would they want to do that? LOL

Re: Word Automation

2011-11-08 Thread Michael Madigan
Yep.  No guarantees with the upgrade and it probably won't be painless.   This is one thing that I really, really hate about Microsoft.  From: Ted Roche tedro...@gmail.com To: profox@leafe.com Sent: Tuesday, November 8, 2011 4:31 PM Subject: Re: Word Automation

Re: Word Automation

2011-11-08 Thread Sytze de Boer
Oh wow Would you be prepared to share the code with others? S On Wed, Nov 9, 2011 at 10:48 AM, Jarvis, Matthew mat...@mckweb.com wrote: Ok. Let me rephrase the question. I have government forms that I can get in fillable pdf or word documents. I need my application to fill out those

RE: Word Automation

2011-11-08 Thread Jarvis, Matthew
Oh wow Would you be prepared to share the code with others? Sure, no problem... Again, thanks to Ted for showing me the light... A bit verbose but in places I deal with different sorts of data types and you might find it useful... and too lazy to trim it... ;) FYI this is being read

Re: Word Automation in Windows 7 as Restricted User

2010-06-10 Thread Ken Dibble
Running as a Domain Administrator removes UAC on Vista, I believe it is the same on Windows 7. Even Internet Explorer will run in the administrative privilege with this user. Actually, it doesn't work that way in Windows 7. You will still get UAC confirmation dialogs in Windows 7 even when

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-09 Thread Ken Dibble
Also, just running my compiled .exe, without accessing the Word automation feature--just starting it and shutting it down--as a standard user, produces VFP error 57 not enough disk space on the line: SET RESOURCE TO in my environment object. I thought this was because the foxuser

Word Automation in Windows 7 as Restricted User

2010-06-09 Thread Ken Dibble
This is a continuation of my Word Automation: OLE exception error 5981 in Windows 7 thread. Thanks to some great help from many of you, so far I have accomplished the following: 1. I established that my Word 97 automation system works fine in Windows XP once I make sure a required .bmp file

RE: Word Automation in Windows 7 as Restricted User

2010-06-09 Thread Tracy Pearson
Ken Dibble wrote on 2010-06-09: This is a continuation of my Word Automation: OLE exception error 5981 in Windows 7 thread. snip However, even with the User Account Control: Behavior of the elevation prompt for standard users item set to Prompt for credentials, when the Word 97 automation

Re: Word Automation in Windows 7 as Restricted User

2010-06-09 Thread Stephen Russell
On Wed, Jun 9, 2010 at 2:53 PM, Tracy Pearson tr...@powerchurch.com wrote: Running as a Domain Administrator removes UAC on Vista, I believe it is the same on Windows 7. Even Internet Explorer will run in the administrative privilege with this user. You found the Word.Application in the

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Ken Dibble
[Ted suggested disabling anti-virus] That didn't work. However, it prompted me to actually look at my error logs. Sometimes I forget that I have a logging feature. In Windows 7 the error definitely occurs on .documents.Add (or .documents.Add(), or documents.Add(cSomePathSomeFile). However,

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Malcolm Greene
Ken, and fails with This is not a valid file name. Can you log what file name is failing? Possible reasons for the failure: - use of virtual folder names like My Documents - spaces in path (should work, but not always reliable) - illegal chars in file name, eg. , , etc. My bet is on the

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Ken Dibble
and fails with This is not a valid file name. Can you log what file name is failing? Possible reasons for the failure: - use of virtual folder names like My Documents - spaces in path (should work, but not always reliable) - illegal chars in file name, eg. , , etc. My bet is on the first

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Tracy Pearson
Ken Dibble wrote on 2010-06-08: As I've described, at that point in Windows 7, Word has created a 1 kb temp ~$Normal.dot file in the same location as Normal.dot, which, in Windows 7, is C:\Users\kend\My Documents\Office Templates\--a legally writeable location. And the Normal.dot template

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Tracy Pearson
Ken Dibble wrote on 2010-06-08: As I've described, at that point in Windows 7, Word has created a 1 kb temp ~$Normal.dot file in the same location as Normal.dot, which, in Windows 7, is C:\Users\kend\My Documents\Office Templates\--a legally writeable location. And the Normal.dot template

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Ken Dibble
elevation error as above. Also, just running my compiled .exe, without accessing the Word automation feature--just starting it and shutting it down--as a standard user, produces VFP error 57 not enough disk space on the line: SET RESOURCE TO in my environment object. I thought

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-08 Thread Fred Taylor
! Whoohoo!! However, I have yet to figure out how to get it to run for a standard user. For a standard user, I still get the Operation requires elevation error as above. Also, just running my compiled .exe, without accessing the Word automation feature--just starting it and shutting it down

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-07 Thread Ken Dibble
What SP level in Word 97? I found that having it fully patched (SP2, I believe was the last one released for Office 97) did clear up some relatively esoteric automation issues back in the day. I had SR 1. Upgrading to SR 2 in Windows 7 was interesting; the installation failed because it

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-07 Thread Ted Roche
On Mon, Jun 7, 2010 at 12:05 PM, Ken Dibble krdib...@frontiernet.net wrote: On Friday I saw some other folks had suggestions, but I didn't forward them to my work email so I'll look at those again tonight. Ken: You can always find the thread on the leafe.com archives:

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-07 Thread Ken Dibble
On Friday I saw some other folks had suggestions, but I didn't forward them to my work email so I'll look at those again tonight. Ken: You can always find the thread on the leafe.com archives: http://leafe.com/archives/full_thread/441824 Jeez, thanks Ted! I don't know why I never think

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Ken Dibble
Ken, I realize you've said it worked before using FCREATE, but just wondering if you ran any tests with an existing DOC file instead of creating a 0 byte new/empty file each time - just to see if it has any effect. Bill If I create and save an empty Word document (containing a single

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Bill Arnold
Ken, I've kept a distance from Word automation after hearing of compatibility headaches, but I couldn't resist in a few cases. Just took at look and I see that in these cases I'm creating a new doc, and none involves a reference to an existing file (new/empty or prev existing) for the operation

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Ken Dibble
Ken, I've kept a distance from Word automation after hearing of compatibility headaches, but I couldn't resist in a few cases. Just took at look and I see that in these cases I'm creating a new doc, and none involves a reference to an existing file (new/empty or prev existing) for the operation

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Richard Kaye
] On Behalf Of Ken Dibble Sent: Friday, June 04, 2010 2:06 PM To: profoxt...@leafe.com Subject: RE: Word Automation: OLE exception error 5981 in Windows 7 Ken, I've kept a distance from Word automation after hearing of compatibility headaches, but I couldn't resist in a few cases. Just took

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Bill Arnold
Ken, I've kept a distance from Word automation after hearing of compatibility headaches, but I couldn't resist in a few cases. Just took at look and I see that in these cases I'm creating a new doc, and none involves a reference to an existing file (new/empty or prev existing

Re: Word Automation: OLE exception error 5981 in Windows 7

2010-06-04 Thread Ted Roche
awful errors with Word automation when we switched machines and the other machines AV would hang the file open for longer than my automation code expected, leading to wacky and misleading errors. If you can, try disabling it, at least for Word docs, and see if you're seeing the same problems. Anti

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-03 Thread Richard Kaye
What happens if you use a specific document reference in the Add call? rk -Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ken Dibble Sent: Thursday, June 03, 2010 12:03 AM To: profoxt...@leafe.com Subject: RE: Word Automation: OLE

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-03 Thread Ken Dibble
What happens if you use a specific document reference in the Add call? Interesting you should ask. This old code I'm using would create the new document and get a file handle for it with FCREATE(), then it would leave the file open to lock it to avoid surprises. This worked fine in Windows

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-03 Thread Bill Arnold
Ken, I realize you've said it worked before using FCREATE, but just wondering if you ran any tests with an existing DOC file instead of creating a 0 byte new/empty file each time - just to see if it has any effect. Bill ___ Post Messages to:

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-02 Thread Ken Dibble
I have some Word automation code that worked fine in Win 2000 but is not working in Win 7. Yeah, I'm using Word 97, but I have heard that this problem can also occur with Word 2003, so let's for the sake of argument hold off on the jeering and see if there are any solutions, okay

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-02 Thread Bill Arnold
, 2010 8:17 PM To: profoxt...@leafe.com Subject: RE: Word Automation: OLE exception error 5981 in Windows 7 I have some Word automation code that worked fine in Win 2000 but is not working in Win 7. Yeah, I'm using Word 97, but I have heard that this problem can also occur

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-06-02 Thread Ken Dibble
This KB related to the general topic Could Not Open Macro Storage might be informative? http://support.microsoft.com/kb/224338 Thanks Bill. I had already seen that early on. I did try some of the suggestions in that article, and they didn't work. I don't know how to programmatically load a

Word Automation: OLE exception error 5981 in Windows 7

2010-05-27 Thread Ken Dibble
Hi folks, I have some Word automation code that worked fine in Win 2000 but is not working in Win 7. Yeah, I'm using Word 97, but I have heard that this problem can also occur with Word 2003, so let's for the sake of argument hold off on the jeering and see if there are any solutions, okay

RE: Word Automation: OLE exception error 5981 in Windows 7

2010-05-27 Thread Jarvis, Matthew
-Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of Ken Dibble Sent: Thursday, May 27, 2010 7:29 AM To: profoxt...@leafe.com Subject: Word Automation: OLE exception error 5981 in Windows 7 Hi folks, I have some Word

Word automation

2008-09-22 Thread Rafael Copquin
I usually use this code to launch Excel via automation: if upper(vartype(thisform.oExcel)) O thisform.oExcel=createobject(Excel.Application) else thisform.oExcel=getobject( , Excel.Application) endif The above code was derived from the Hacker's Guide by Tamar Granor and others.

RE: Word automation

2008-09-22 Thread Allen
I thought it was the other way round. Check for getobject then if not create it. Allen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rafael Copquin I usually use this code to launch Excel via automation: if upper(vartype(thisform.oExcel)) O

RE: Word automation

2008-09-22 Thread Dave Crozier
: Word automation I usually use this code to launch Excel via automation: if upper(vartype(thisform.oExcel)) O thisform.oExcel=createobject(Excel.Application) else thisform.oExcel=getobject( , Excel.Application) endif The above code was derived from the Hacker's Guide by Tamar Granor

Re: Word automation

2008-09-22 Thread Chris Davis
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rafael Copquin Sent: 22 September 2008 11:47 To: profox Subject: Word automation I usually use this code to launch Excel via automation: if upper(vartype(thisform.oExcel)) O thisform.oExcel=createobject(Excel.Application

RE: Word automation

2008-09-22 Thread Tracy Pearson
My experience has been it's a hit and miss. I never tried to figure out how/why I got one or the other. Tracy -Original Message- From: Chris Davis Sent: Monday, September 22, 2008 12:10 PM and if excel is loaded more than once ? is it possible to get access to either ? 2008/9/22 Dave

Re: Word automation

2008-09-22 Thread Chris Davis
this is why i changed the way excel loads so that when i create an instance to use from my app it creates a new instance and leaves any the user has opened themselves alone 2008/9/22 Tracy Pearson [EMAIL PROTECTED] My experience has been it's a hit and miss. I never tried to figure out how/why

Re: Word automation

2008-09-22 Thread Richard Kaye
I usually do something like this: WAIT WINDOW [Finding Excel...] NOWAIT NOCLEAR LOCAL loExcel AS Excel.Application, loWorkbook AS Excel.Workbook, loSheet AS EXCEL.Worksheet TRY loExcel=GETOBJECT(,[excel.application]) CATCH swallow the error if excel isn't running. ENDTRY IF

Re: Word automation

2008-09-22 Thread Rafael Copquin
Thank you guys I'll look into your suggestions Rafael - Original Message - From: Rafael Copquin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 22, 2008 7:47 AM Subject: Word automation I usually use this code to launch Excel via automation: if upper(vartype

Margins in Word Automation

2007-06-26 Thread James E Harvey
This makes the margins for the first two pages, but the rest of the document's margins don't follow? oword = createobject(word.application) oword.visible = .t. oword.documents.open(lcword) #define autoinchestopoints 72 #define wdtableaderdots 1 #define wdaligntabright 1 #define wdaligntableft 0

RE: Margins in Word Automation

2007-06-26 Thread Tracy Pearson
Section breaks can have different margins. Tracy -Original Message- From: James E Harvey Sent: Tuesday, June 26, 2007 11:11 AM This makes the margins for the first two pages, but the rest of the document's margins don't follow? SNIP / James E Harvey Hanover Shoe Farms, Inc.