trouver nom fichier sans extension
Bonjour j'ai mon petit script qui fonctionne très bien
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Users\padawan\Desktop\ScriptUserInfo\CSVFiles"
Set x = CreateObject("scripting.filesystemobject")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
If UCase(objFSO.GetExtensionName(objFile.name)) = "TXT" Then
Set word = CreateObject("Word.Application")
word.Visible = False
Set objectdocument = word.Documents.Open ("C:\Users\padawan\Desktop\ScriptUserInfo\CSVFiles\" & objFile.Name)
Set oDoc=objectdocument
word.selection.Wholestory
word.selection.Font.Name = "Times New Roman"
word.selection.Font.Size = 6
oDoc.PageSetup.Orientation=1 ' Landscape
WScript.Sleep 1000
objectDocument.SaveAs "C:\Users\padawan\Desktop\ScriptUserInfo\CSVFiles\" & objfile.Name & ".doc", wdFormatDocument=0
Word.Quit
Set word = nothing
Else
End If
Next |
Donc je passe d'un fichier txt à un fichier doc...
là ou ça accroche c'est objectDocument.SaveAs ou le fichier se trouve a enregistrer le nom objfile.Name et ce AVEC l'extension .txt...donc ça donne nomdefichier.txt.doc
Évidement j'aimerais que ce ne soit que nomdefichier.doc
Comme faire pour faire de la sorte...
J'ai trouvé ceci mais je ne sais comment l'intégrer???
Code:
(objfile.Name, InStrRev(objfile.Name, ".") - 1)
MErci