Afficher un message
Vieux 28/11/2005, 10h06   #9 (permalink)
_Thierry
XLDnaute Barbatruc
 
Date d'inscription: février 2005
Messages: 3 100
Par défaut Re:définir répertoire courant

Bonjour Michel, Dan, Charly, Frfiscogreencar, le Forum

En fait je me pose la question si j'ai bien lu la demande... Mais je crois que la soultion est avec 'MkDir'...

Faire une recherche dans le Forum Première génération qui proposera entre autre ce Fil Création de Repertoire

Grosso Modo, mais je dois partir, ça donnerait un truc comme ça :

Citation:
Sub CheckingMakingDir()
Dim TheCurrentPath AsString
Dim TheCurrentDir AsVariant
Dim i As Byte, NbRep AsByte
Dim ThePath AsString
Dim TheName AsString


ThePath = 'C:\temp\'
TheName = ActiveWorkbook.Name

TheCurrentPath = CurDir
TheCurrentDir = Split(TheCurrentPath, '\')


NbRep = UBound(TheCurrentDir)
* * * * ThePath = ThePath & TheCurrentDir(NbRep) & '\'
* * * * MakingDir ThePath
ActiveWorkbook.SaveAs Filename:=ThePath & TheName
EndSub

Sub MakingDir(ThePath As String)
OnErrorGoTo TheEnd
* * MKDIR ThePath
TheEnd:
EndSub

Bonne Journée
[ol]@+Thierry[/ol]

PS si tu as au moins Excel 2000, (sinon pour Excel 97, il faut passer par une combinaison de Instr et de Mid car il ne connait pas la Function Split)
_Thierry est déconnecté   Réponse avec citation