Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with this code 1

Status
Not open for further replies.

EKC

Technical User
Jan 13, 2001
43
0
0
CA
Hi,
I have progam that should send result of two select statement to text files and then run macro in Excel that parse those text files and populate cells.
Code have only 2 lines:
Select field1,field2 from table1 to file Text1.txt
Select field1,field2 from table2 to file Text2.txt


Questions:
1. To execute second select statement I have to keep pressing any key to go to the end of result set.Is there any way to avoid this(I tryed Go Bottom but doesn't help)so I have program that populate those text files without any user interaction?
2.If I want to open Excel file where I have macro that parse text from those text files I tryed adding thost lines I read in another posting:
oX=CreateObject("Excel.Application")
oX.Workbooks.Open("C:\Book1.xls")

but it doesn't do anything nor I have any message?
Any help appreciated
Lyn

 
You left the 'NOCONSOLE' arguement out of your SELECT, Lyn. Can't help you with the Excel problem. Good luck! --Zog
 
Hi
Try oX.Visible=.T., it may solve your problem.
Walid Magd
Engwam@Hotmail.com
 
EKC, try this for excell, the ox. was not working for me either. this is what I used:

oleApp = CREATEOBJECT("Excel.Application")
oleApp.Visible=.T.
oleApp.WorkBooks.Open("S:\Working\Reports\State.Xls")
*
oleApp.ActiveSheet.PivotTables("PivotTable1").RefreshTable
oleApp.ActiveWorkbook.SaveAs((cpath)+"state.XLS")
oleApp.Quit

That opens excell, opens my file (state.xls) refreshs my pivot table, saves to a path, and quits excell.

I hope this helps
-Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top