DM2
Mechanical
- Oct 20, 2007
- 147
I need a macro that runs every time the spreadsheet is launched, which will automatically run the "Text Import Wizard" on a specific directory.
I have a DOS batch file that executes when you use the "RIGHT MOUSE" button and execute a Short Cut menu option in Windows Explorer I created. When I use this short cut menu on a directory of my choosing, the DOS batch file prints the files in that directory to a text file and saves the text file as "00.TXT" in the "C:\Utilities\Print Directory\"
What I would like to do next is have the batch file automatically open Excel and have excel point to that directory so I can import the text.
I'm not very good with Excel 2003 macro's and I've done some searching on the web for answers but I still haven't figured it out. Below is my current macro:
--------------------------
Sub Import_Text_File()
myFile = Application.GetOpenFilename("Text Files,C:\Utilities\Print Directory\*.txt")
Workbooks.OpenText Filename:=myFile
End Sub
---------------------------
My 1st problem with the macro is that once I've selected the file and clicked "OPEN" the "Text Import Wizard" doesn't run to let me make adjustments.
My 2nd Problem is that I want this macro to execute automatically and that's not happening.
Any Suggestions?
I have a DOS batch file that executes when you use the "RIGHT MOUSE" button and execute a Short Cut menu option in Windows Explorer I created. When I use this short cut menu on a directory of my choosing, the DOS batch file prints the files in that directory to a text file and saves the text file as "00.TXT" in the "C:\Utilities\Print Directory\"
What I would like to do next is have the batch file automatically open Excel and have excel point to that directory so I can import the text.
I'm not very good with Excel 2003 macro's and I've done some searching on the web for answers but I still haven't figured it out. Below is my current macro:
--------------------------
Sub Import_Text_File()
myFile = Application.GetOpenFilename("Text Files,C:\Utilities\Print Directory\*.txt")
Workbooks.OpenText Filename:=myFile
End Sub
---------------------------
My 1st problem with the macro is that once I've selected the file and clicked "OPEN" the "Text Import Wizard" doesn't run to let me make adjustments.
My 2nd Problem is that I want this macro to execute automatically and that's not happening.
Any Suggestions?