![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne |
#3
| |||
| |||
|
|
Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne |
#4
| |||
| |||
|
|
"Phil" skrev i meddelelsen news:j2g5n2$r8h$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 10:47:51, "bsn" wrote: Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne Hi Bjarne, only guessing, but I suspect the "&" is not the correct concatenation symbol for DOS see http://www.dostips.com/DtTipsStringM...oncat enation ------------------------------------------------------ Hi Phil thx for answer... I make the line in VBA code(not DOS) - creating a file with FileSystemObject...out in a resulting .bat file... The task is to get VBA syntax correct...i think... Bjarne |
#5
| |||
| |||
|
|
"Phil" skrev i meddelelsen news:j2g5n2$r8h$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 10:47:51, "bsn" wrote: Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne Hi Bjarne, only guessing, but I suspect the "&" is not the correct concatenation symbol for DOS see http://www.dostips.com/DtTipsStringM...oncat enation ------------------------------------------------------ Hi Phil thx for answer... I make the line in VBA code(not DOS) - creating a file with FileSystemObject...out in a resulting .bat file... The task is to get VBA syntax correct...i think... Bjarne |
#6
| |||
| |||
|
| "Phil" skrev i meddelelsen news:j2ggvc$m9f$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 12:00:25, "bsn" wrote: "Phil" skrev i meddelelsen news:j2g5n2$r8h$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 10:47:51, "bsn" wrote: Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne Hi Bjarne, only guessing, but I suspect the "&" is not the correct concatenation symbol for DOS see http://www.dostips.com/DtTipsStringM...oncat enation ------------------------------------------------------ Hi Phil thx for answer... I make the line in VBA code(not DOS) - creating a file with FileSystemObject...out in a resulting .bat file... The task is to get VBA syntax correct...i think... Bjarne Sorry, maybe I was wrong, I appreciate you are using VBA, but I think the bat file is a DOS file. ----------------------------------------------------------- yes - the resulting .bat file is a dos file... Here is my VBA code...if it helps... Code: Dim fso, myFile Dim Linie1, Linie2 As String Dim Drev, Sti, Fil As String Dim x As Single x = InStrRev(Mappe, "\") Drev = Mid(Mappe, 1, 3) Sti = Mid(Mappe, 4, x) Fil = Filnavn Linie1 = "echo off" Linie2 = "copy " & Drev & Sti & Fil & " " & Drev & Sti & "test_" & Fil MsgBox Linie1 & vbCrLf & Linie2 Set fso = CreateObject("Scripting.FileSystemObject") Set myFile = fso.CreateTextFile(myPath, True) myFile.WriteLine (Linie1) myFile.WriteLine (Linie2) myFile.Close /Code Bjarne |
#7
| |||
| |||
|
| "Phil" skrev i meddelelsen news:j2ggvc$m9f$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 12:00:25, "bsn" wrote: "Phil" skrev i meddelelsen news:j2g5n2$r8h$1 (AT) speranza (DOT) aioe.org... On 17/08/2011 10:47:51, "bsn" wrote: Hi NG... I try to make a file with CreateFile It works fine - but... When i make this line : MyFile.WriteLine ("copy " & Folder & Filename & " " & Folder & "test_" & Filename)... The resulting file looks like this(3 lines) : copy C:\testFolder\Filename.txt D:\testFolder\Filename.txt I want the result on 1 line ... copy C:\testFolder\Filename.txt D:\testFolder\test_Filename.txt Help wanted... Bjarne Hi Bjarne, only guessing, but I suspect the "&" is not the correct concatenation symbol for DOS see http://www.dostips.com/DtTipsStringM...oncat enation ------------------------------------------------------ Hi Phil thx for answer... I make the line in VBA code(not DOS) - creating a file with FileSystemObject...out in a resulting .bat file... The task is to get VBA syntax correct...i think... Bjarne Sorry, maybe I was wrong, I appreciate you are using VBA, but I think the bat file is a DOS file. ----------------------------------------------------------- yes - the resulting .bat file is a dos file... Here is my VBA code...if it helps... Code: Dim fso, myFile Dim Linie1, Linie2 As String Dim Drev, Sti, Fil As String Dim x As Single x = InStrRev(Mappe, "\") Drev = Mid(Mappe, 1, 3) Sti = Mid(Mappe, 4, x) Fil = Filnavn Linie1 = "echo off" Linie2 = "copy " & Drev & Sti & Fil & " " & Drev & Sti & "test_" & Fil MsgBox Linie1 & vbCrLf & Linie2 Set fso = CreateObject("Scripting.FileSystemObject") Set myFile = fso.CreateTextFile(myPath, True) myFile.WriteLine (Linie1) myFile.WriteLine (Linie2) myFile.Close /Code Bjarne |
#8
| |||
| |||
|
|
I have put in the complete module Function Test(Mappe As String, MyPath As String) 'Print Test("C:\testFolder\Filename.txt", "C:\Phil Data\Access\MDB 2010\TestFile") Dim fso, myFile Dim Linie1, Linie2 As String Dim Drev, Sti, Fil As String Dim x As Single x = InStrRev(Mappe, "\") Drev = Mid(Mappe, 1, 3) Sti = Mid(Mappe, 4, x) 'Fil = Filnavn Linie1 = "echo off" Linie2 = "copy " & Drev & Sti & Fil & " " & Drev & Sti & "test_" & Fil 'MsgBox Linie1 & vbCrLf & Linie2 Set fso = CreateObject("Scripting.FileSystemObject") Set myFile = fso.CreateTextFile(MyPath, True) myFile.WriteLine (Linie1) myFile.WriteLine (Linie2) myFile.Close End Function Not sure exactly what your input is The second line is what you type in the immediate window The output of TestFile is: echo off copy C:\testFolder\Fil C:\testFolder\Filtest_ Not, I suspect, what you want, but all on one line. Windows 7, Access 2010, and the Testfile viewed using Notepad Phil --------------------------------------------------------------------------------- I am using the exact same configuration... When i use ur function as is, Linie2 comes out in one line, but when i go back to my path(variables) the output comes in 3 lines again... Its just like when the path is getting longer, the output comes in 3 lines like the starting point of this thread... I discovered that the Left and Mid function dont give the right answer... ex : Drive = Left(Path,3) should give the Drive(C:\), but it only gives 1 letter(C)... Are A2010 very buggy or what...??? its annoying... Bjarne Hi Bjarne |
#9
| |||
| |||
|
|
I have put in the complete module Function Test(Mappe As String, MyPath As String) 'Print Test("C:\testFolder\Filename.txt", "C:\Phil Data\Access\MDB 2010\TestFile") Dim fso, myFile Dim Linie1, Linie2 As String Dim Drev, Sti, Fil As String Dim x As Single x = InStrRev(Mappe, "\") Drev = Mid(Mappe, 1, 3) Sti = Mid(Mappe, 4, x) 'Fil = Filnavn Linie1 = "echo off" Linie2 = "copy " & Drev & Sti & Fil & " " & Drev & Sti & "test_" & Fil 'MsgBox Linie1 & vbCrLf & Linie2 Set fso = CreateObject("Scripting.FileSystemObject") Set myFile = fso.CreateTextFile(MyPath, True) myFile.WriteLine (Linie1) myFile.WriteLine (Linie2) myFile.Close End Function Not sure exactly what your input is The second line is what you type in the immediate window The output of TestFile is: echo off copy C:\testFolder\Fil C:\testFolder\Filtest_ Not, I suspect, what you want, but all on one line. Windows 7, Access 2010, and the Testfile viewed using Notepad Phil --------------------------------------------------------------------------------- I am using the exact same configuration... When i use ur function as is, Linie2 comes out in one line, but when i go back to my path(variables) the output comes in 3 lines again... Its just like when the path is getting longer, the output comes in 3 lines like the starting point of this thread... I discovered that the Left and Mid function dont give the right answer... ex : Drive = Left(Path,3) should give the Drive(C:\), but it only gives 1 letter(C)... Are A2010 very buggy or what...??? its annoying... Bjarne Hi Bjarne |
#10
| |||
| |||
|
| "Phil" skrev i meddelelsen news:j2k19c$rso$1 (AT) speranza (DOT) aioe.org... |
![]() |
| Thread Tools | |
| Display Modes | |
| |