Hi Avinash, - remember I expect you to read all my reply. I don’t expect you to understand it all and I will keep helping you further on this issue, - but you know I will not reply quickly. So use the time to read carefully and slowly all I write here for you….…
Once again your reply makes no sense!! Your reply is nonsense.
I still think that you have not understood anything about text files. You have understood still nothing about the .csv story…..
Same story and reply as as here: https://excelfox.com/forum/showthrea...ll=1#post13433
Same answer as here… https://excelfox.com/forum/showthrea...iles#post13493
Originally Posted by
DocAElstein
....This makes no sense, since you are comparing two different things. I have explained that to you in great detail many times already. ....
….etc… etc….
Let me try to explain again….
You know that code lines like this , Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\sample2.csv") , will ( try ) to open a file. It would open an excel file, no problem. It may or may not work to open a text file. Sometimes it may work. Sometimes it may not work. You must know this, because lots of people have told you all this hundreds of times already!!!
In my macro I do not have any line like that for sample2.csv
Why do I not have any line like that for sample2.csv?
Because (bcoz ) . …..
sample2.csv is a text file!!!!!!
My macro does not open a text file with Excel
Also this macro https://excelfox.com/forum/showthrea...ll=1#post13431 does not open a text file with Excel
HansV does not try to open a text file with Excel
Logit here https://chandoo.org/forum/threads/fe...2/#post-264364 , does not try to open a text file with Excel
I do not try here http://www.eileenslounge.com/viewtop...269105#p269105 at Eileen’s Lounge to open a text file with Excel
jindon at excelforum here https://www.excelforum.com/excel-pro...ml#post5340067 does not try to open a text file with Excel
No one anywhere ( except you ) is trying to open a text file in Excel!!!
Forget Opening text file in Excel. That is stupid. It can be done but only sometimes will work!!!!
We are all not opening a text file in Excel. We are manipulating a text file using VBA. We use things like this, I already told you hundreds of times… https://www.homeandlearn.org/open_a_...le_in_vba.html - We all open a text file in/ with Excel VBA - we do not ry to open a text file in/ with Excel. To open a text file with Excel is bad, stupid, dangerous. It may not work and may cause many problems later. You have already wasted many weeks of your time and others to open a text file with Excel. It has often given you problems. You go around and around in circles and get no where because of this stupidity!!
( If you really want to open the text file with Excel, then you can try to do it after the problem is solved. – I already did it at the end of the macro, to get this: https://excelfox.com/forum/showthrea...ll=1#post13431
Also, look at the end of the macro:
Code:
'Rem 6 Check File in Excel VBA open
'' Workbooks.Open Filename:=ThisWorkbook.Path & "\" & "Sample2.csv"
' Workbooks.Open Filename:=ThisWorkbook.Path & Application.PathSeparator & "Sample2After.csv" ' CHANGE TO SUIT
End Sub
If you want to open the text file with Excel then do like this:
Code:
Rem 6 Check File in Excel VBA open
' Workbooks.Open Filename:=ThisWorkbook.Path & "\" & "Sample2.csv"
Workbooks.Open Filename:=ThisWorkbook.Path & Application.PathSeparator & "Sample2After.csv" ' CHANGE TO SUIT
End Sub
OR like this:
Code:
Rem 6 Check File in Excel VBA open
' Workbooks.Open Filename:=ThisWorkbook.Path & "\" & "Sample2.csv"
' Workbooks.Open Filename:=ThisWorkbook.Path & Application.PathSeparator & "Sample2After.csv" ' CHANGE TO SUIT
Dim Wb As Workbook
Set Wb = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\sample2.csv")
End Sub
)
But that all has nothing to do with the issue of this Thread
If you must, just for fun, you can try to open the file in Excel only at the end of the macro , after the macro has solved the issue.
The macro solves the issue. It solves the problem. But it does not need to open a text file with Excel – it solves the problem by manipulating a text file using VBA
Let me try again to explain….
My macro solves your problem. It answers your question. It works perfectly.
But, my macro needs to know where ( the path ) to text file is……
This code line tells it where the text file is
Code:
Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & "Sample2.csv" ' ' CHANGE TO SUIT ' "sample2 ef 5 June.csv" From Avinash : https://excelfox.com/forum/showthread.php/2505-copy-paste-the-data-if-condition-matches?p=13470&viewfull=1#post13470 sample2 ef 5 June.csv : https://app.box.com/s/0j4118cwzzofe76ytb5rqkvz3qj0vseu
Question:
Originally Posted by
fixer
.....
Path is different, It is not in the same path ......
Answer: ' CHANGE TO SUIT
Code:
Let PathAndFileName = "C:\Users\WolfieeeStyle\Desktop\sample2.csv"
( Forget this .._
Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\sample2.csv")
_.. that is nonsense and has nothing at all to do with any of the issues in your original question!!!! )
I cant reply again here for a few hours. So take your time to read all I have written, before any replies…
Alan
Bookmarks