About Carla Fair-Wright Expertise I can answer most general questions regarding Visual FoxPro. I am also very good with WSH, WMI,and FSO scripting and most internet technologies.
I like to answer questions. To me there is no such thing as a dumb question. Don't be afraid to ask me anything about FoxPro or Visual FoxPro. I will try to answer all questions as quickly as I can. It may take me a day or longer for a complex error or one that is hard to reproduce. Please include the version of FoxPro you are using.
Experience My professional experience with computer programming started in my early twenties, I went back to college with thoughts of finishing an engineering degree and ended up in computer science.
I have used Oracle, SQL Server, Access, and FoxPro.
Experience in the area I have been using the product for over 10 years. I am a MCP in Visual FoxPro (Desktop).
I am ASQ Certified in Software Quality Engineering
Publications
Books
Chapter Author, Case Studies and Applications of Web Based Energy Information and Control Systems (Fairmont Press), June 2005
Chapter Author, Encyclopedia of Energy Engineering and Technology 1st Edition, (Francis Books) Spring 2006
-------------------------------------------
The text above is a follow-up to ...
-----Question-----
I have a 43 .doc files. i would like to combine all files in one.doc file? can i use fox pro OLE to accomplish above
-----Answer-----
Ashisha,
I don't know what version of FoxPro you are using or what version of Word. You can use Foxpro to manipulate word documents. You'll have to use VBA which means FoxPro 3.0 or higher.
Thanks Carla for quick response, I am using vfp 6.0
PARA lext, lbrow, lrpt
lTrans=.f.
nErrorCount=2
close table all
use macrotxt in 0 excl
sele macrotxt
zap
appe blank
repl l1 with "Sub CreateManual()"
use macroins in 0 excl
use macfiles in 0 excl
sele macfiles
zap
=messagebox("Select the Client-Specific Manual Pages List - TXT File",0+64,"Select TXT File")
appe from ? type sdf
store reccount() to nMaxRec
go top
do while ! eof()
store recno() to nRecNo
store '"'+allt(filename)+'", _' to cFileName
sele macroins
store allt(f1)+cFileName to cL1
sele macrotxt
appe blank
repl l1 with cL1
nCount=2
sele macroins
do while nCount<=12
store "f"+allt(str(nCount)) to cFldName
store &cFldName to cL1
sele macrotxt
if nRecNo=nMaxRec and nCount=10
* do nothing
else
appe blank
repl l1 with cL1
endif
nCount=nCount+1
sele macroins
enddo
sele macfiles
skip
enddo
sele macrotxt
appe blank
repl l1 with "End Sub"
copy to macrotxt.doc type sdf
! /N "C:\Program Files\Microsoft Office\Office11\WINWORD.EXE" K:\ChoiceOneLink\Manual\GroupGuideTemplate\macrotxt.doc
retu
above is my code.after this i go to word and create the macro word by coping the text. and i manually run the macro in in word and save the file with new name.
What i am donid in word i would like to do in vfp 6.0 using OlE. cloud you please help me ?
loWordSession = CREATEOBJECT('Word.Application')
loWordSession.Documents.Add
loWordSession.Visible = .T. && for testing
MESSAGEBOX("Select the Client-Specific Manual Pages List - TXT File",0+64,"Select TXT File")
lcFileName = GETFILE("txt")
* we ask for the 43 files to be added. I suggest you change this to a listbox
* using a listbox will allow to user select all the files at one time or
FOR liNumberOfDocuments = 1 TO 43
WITH loWordSession
.SELECTION.EndKey( wdStory ) && go to the end of the document
.SELECTION.InsertFile(lcFileName,"", No_ConfirmConversions,No_Link,No_Attachment)
MESSAGEBOX("Select the Client-Specific Manual Pages List - TXT File",0+64,"Select TXT File")
lcFileName = GETFILE("txt")
* no file was selected
IF EMPTY( lcFileName )
EXIT
ENDIF
ENDWITH
ENDFOR
* this is the combined document we save
lcFileName = "macrotxt.doc"