Hello everybody.
I need a little help with one small issue in macro in Excel . The problem is that we upload every day very large txt files out of Internet from many clients ( large USA banks in this case Citi ,Chase and so on) and I was given a task to automated this as we can . So , I have come up with this macro which is working ok .The user( the file is located on the share drive and there are many users ) opens the excel file and macro start running as the file is opened .Everything is fine , but I would like to rid off of part of the code FileName that asks user to type the file into input box due to many mistypes .The file is names as A1234567.TXT so it has 7 digits and txt extension at the end and the excel bugs it as mistake if I assign the code like this:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
FileName =FLName,
<o> </o>
Because of txt extension of the end the file. I am programming now to rid of txt extension and the name the new worksheet and when the user click on file to upload so they don’t need to type it in input box, therefore there will not be mistyped of the name of the file would be made that is imperative for business where I working. So far I have gotten no success and I am really appreciate any hint how I can accomplish this.
<o> </o>
<o> </o>
<o> </o>
<o> </o>
Sub Macro1()
Dim Filename As String
Dim FLName As String
FLName = Application.GetOpenFilename
Dim NewSheet As Worksheet
Filename = InputBox("Enter the file name")
Worksheets.Add().Name = Filename
Set NewSheet = ActiveSheet
<o> </o>
<o> </o>
<o> </o>
<o> </o>
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" + FLName, _
<o> </o>
The Best Regards ,
<o> </o>
Yours BorisGomel
I need a little help with one small issue in macro in Excel . The problem is that we upload every day very large txt files out of Internet from many clients ( large USA banks in this case Citi ,Chase and so on) and I was given a task to automated this as we can . So , I have come up with this macro which is working ok .The user( the file is located on the share drive and there are many users ) opens the excel file and macro start running as the file is opened .Everything is fine , but I would like to rid off of part of the code FileName that asks user to type the file into input box due to many mistypes .The file is names as A1234567.TXT so it has 7 digits and txt extension at the end and the excel bugs it as mistake if I assign the code like this:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
FileName =FLName,
<o> </o>
Because of txt extension of the end the file. I am programming now to rid of txt extension and the name the new worksheet and when the user click on file to upload so they don’t need to type it in input box, therefore there will not be mistyped of the name of the file would be made that is imperative for business where I working. So far I have gotten no success and I am really appreciate any hint how I can accomplish this.
<o> </o>
<o> </o>
<o> </o>
<o> </o>
Sub Macro1()
Dim Filename As String
Dim FLName As String
FLName = Application.GetOpenFilename
Dim NewSheet As Worksheet
Filename = InputBox("Enter the file name")
Worksheets.Add().Name = Filename
Set NewSheet = ActiveSheet
<o> </o>
<o> </o>
<o> </o>
<o> </o>
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" + FLName, _
<o> </o>
The Best Regards ,
<o> </o>
Yours BorisGomel