![]() |
"Open with.. Excel" in vb
I use a program that outputs a large text file of numerical data. The output
of the program can be set such that using the "Open with Excel.." command in Windows automatically gives a neat, aligned data set in Excel with headers in the correct places etc. (with excel text wizard this is a long process) How can the "Open with Excel.." command be activated using vb in Excel? Thanks Mo |
"Open with.. Excel" in vb
Workbooks.OpenText (arg1, arg2, ...).
See help file for more info. HTH, arunkhemlai "Jose Mourinho" wrote: I use a program that outputs a large text file of numerical data. The output of the program can be set such that using the "Open with Excel.." command in Windows automatically gives a neat, aligned data set in Excel with headers in the correct places etc. (with excel text wizard this is a long process) How can the "Open with Excel.." command be activated using vb in Excel? Thanks Mo |
"Open with.. Excel" in vb
Thanks, this is the same command that is used by my current macro though it
is not sorting data correctly. However, if I manually use "Open with Excel" command on the text document (right-click document in Explorer, select Open with...Excel) then everything works fine: with the Workbook.OpenText sub it doesn't. Perhaps the question should be - what are the inbuilt arguments for this "Open with Excel.." command? Jose "arunkhemlai" wrote: Workbooks.OpenText (arg1, arg2, ...). See help file for more info. HTH, arunkhemlai "Jose Mourinho" wrote: I use a program that outputs a large text file of numerical data. The output of the program can be set such that using the "Open with Excel.." command in Windows automatically gives a neat, aligned data set in Excel with headers in the correct places etc. (with excel text wizard this is a long process) How can the "Open with Excel.." command be activated using vb in Excel? Thanks Mo |
"Open with.. Excel" in vb
You can try if the following works for you, else people in win32.programmer
group might be able to help. ' -------------------------------- Option Explicit ' Must add reference to "Windows Scripting Host Object Model ' Your AntiVirus program might prevent the script from running. Sub CallExcel() Dim WshShell Set WshShell = CreateObject("WScript.Shell") WshShell.Exec ("excel ""C:\Documents and Settings\Administrator\Desktop\yourfile.txt""") Set WshShell = Nothing End Sub ' -------------------------------- arunkhemlai "Jose Mourinho" wrote: Thanks, this is the same command that is used by my current macro though it is not sorting data correctly. However, if I manually use "Open with Excel" command on the text document (right-click document in Explorer, select Open with...Excel) then everything works fine: with the Workbook.OpenText sub it doesn't. Perhaps the question should be - what are the inbuilt arguments for this "Open with Excel.." command? Jose |
All times are GMT +1. The time now is 07:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com