Jump to content

Excel Import - freezing


Recommended Posts

I have a simple script where I am importing a text file from the desktop into Excel, but it hangs up at the data source selection screen. I can't seem to figure out why. At first I thought it was my computer, so I tested it on another machine and same problem. There is a spot where I am tabbing 7 times to get the data source to select from the desktop, it appears as though the tabbing stops on 'Cancel' and the screen hangs there. Below is a portion of the script, thanks for any thoughts.

Run("C:\Program Files\Microsoft Office\Office11\Excel.exe")

WinwaitActive("Microsoft Excel - Book1")

Send("!d")

WinWaitActive("Microsoft Excel - Book1")

Send("d")

Send("d")

WinWaitActive("Select Data Source")

Send("{TAB 7}")

Send("{Down}")

Send("{Enter}")

Send("all")

Send("{Enter}")

WinWaitActive("Text Import Wizard - Step 1 of 3")

Send("n")

Send("n")

Send("n")

Send("F")

Send("{Enter}")

WinWaitActive("Microsoft Excel - Book1")

Send("^a")

Link to comment
Share on other sites

I have a simple script where I am importing a text file from the desktop into Excel, but it hangs up at the data source selection screen. I can't seem to figure out why. At first I thought it was my computer, so I tested it on another machine and same problem. There is a spot where I am tabbing 7 times to get the data source to select from the desktop, it appears as though the tabbing stops on 'Cancel' and the screen hangs there. Below is a portion of the script, thanks for any thoughts.

Run("C:\Program Files\Microsoft Office\Office11\Excel.exe")

WinwaitActive("Microsoft Excel - Book1")

Send("!d")

WinWaitActive("Microsoft Excel - Book1")

Send("d")

Send("d")

WinWaitActive("Select Data Source")

Send("{TAB 7}")

Send("{Down}")

Send("{Enter}")

Send("all")

Send("{Enter}")

WinWaitActive("Text Import Wizard - Step 1 of 3")

Send("n")

Send("n")

Send("n")

Send("F")

Send("{Enter}")

WinWaitActive("Microsoft Excel - Book1")

Send("^a")

What kind of file are you importing? If it's just a CSV I believe you could just do:
$oExcel = _ExcelBookOpen(@DesktopDir & "\MyFile.csv")

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...