ard Posted July 24, 2006 Posted July 24, 2006 Hi every one, I need some help with a sricpt that list user's text files in one directory then opens them with excel. my problem is that I need the text file to be imported via the Text import wizard. can some one help please..
Iznogoud Posted July 24, 2006 Posted July 24, 2006 Just make the text file a CSV file. Then if you open it, it will automatic be devided in colums etc.
ard Posted July 25, 2006 Author Posted July 25, 2006 Just make the text file a CSV file.Then if you open it, it will automatic be devided in colums etc.This does not work as the user's need to change output via the import wizard, this is the macro code I found, but can not get to work via Auto.'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Sub ImportTextUsingXlDialogOpen() '\ use this approach to prompt user for text wizard values Application.ScreenUpdating = False Application.DisplayAlerts = False '\ display open file dialog and copy to new (temporary workbook) 'On error resume next - traps for user clicking cancel in the import dialog 'Error number is 1004 - is so exit the procedure On Error Resume Next If Application.Dialogs(xlDialogOpen).Show("C:\Magix\*.txt") Then If Err.Number = 1004 Then Exit Sub End If ActiveSheet.UsedRange.Select '\ select imported text in temporary workbook Selection.Copy '\ copy to clipboard ActiveWorkbook.Close '\ close temporary workbook Worksheets.Add Range("A1") = "Dialogs(xlDialogOpen) Method" Range("A2").Select ActiveSheet.Paste '\ paste text into your workbook End If Application.ScreenUpdating = True Application.DisplayAlerts = TrueEnd Sub'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now