Tim;
        Finally got a chance to test your snippet. Thank you for it!

I took the liberty of flushing it out a bit.
================
#!/---
#
import os
import win32com.client

excel = win32com.client.Dispatch( 'Excel.Application' )
excel.Visible=1                # shows the spreadsheet (can be handy)
xlCSV = 6
                               # substitute for list generation
list = ["c:\\temp\\test.xls", "c:\\temp\\test1.xls"]

for nm in list:
  csv = os.path.splitext( nm )[0] + '.csv'
  print "Procesing file:", csv
  if os.path.exists(csv):      # window$ won't auto overwrite
    os.unlink(csv)
  wb = excel.Workbooks.Open( nm )
  wb.SaveAs( csv, xlCSV )
  print wb.Close()             # requires manual verification
                               #  eliminating unattended runs

#wb.Exit()  & wb.Quit()        # generate ERROR(s) - no such thing(s)
                               #  leaving Excel open

excel.Visible=0                # actually closes Excel if no sheet open
                               #  verified via task manager

print "Check to see if this worked."

#                              end of file
=================
The above does in fact work.
Using the above I have a few questions.
Documentation on xlCSV                      came from where?
      "       on .Workbooks.Open(file.xls)  came from ???
      "       on .SaveAs( filename, xlCSV ) came from ???
      "       on .Close()                   came from ???
Tell me about the lack of the .Exit() and/or .Quit(), please.
I ran out of time today. Is it possible to send something like an <enter> keystroke to a Window (<yes><no>) box if it accepts same from actual keyboard? May not work anyway since .Close() hangs (in interactive) awaiting it's answer.

Tim - thank you again! At least this works well enough that a clerk can press <enter> until the thing runs out of material. :) Just press and hold the <enter> key until the buffer overflow beeps and go do some filing and when the screen 'stops' do it again... Eliminates typos.


Thank you.

Steve
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to