Alexxu
08-16-2008, 07:10 AM
Hello.I have a little problem with a vba code.
The code is:
Sub Export()
Workbooks.Add
'aici trebuie sa pun manual alta locatie.
ActiveWorkbook.SaveAs Filename:= _
"D:\Sablon citiri\Calea 13 Septembrie_Sablon citiri " & Format(Date, "dd-mm-yyyy") & ".xls", FileFormat:= _
xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Call MsgBox("Va rog sa asteptati pana se creeaza registrul de lucru. Multumesc!", vbInformation, "Creare sablon")
Windows("Asociatia 13 Septembrie_Dl.Teodorescu.xlsm").Activate
Columns("B:G").Select
Selection.Copy
Windows("Calea 13 Septembrie_Sablon citiri.xls").Activate
Range("B1").Select
ActiveSheet.Paste
Range("I5").Select
Application.CutCopyMode = False
Cells.Select
' in urmatoarea procedura se va schimba fundalul sheet-ului.
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
'acum se va copia tabelul.
Columns("B:B").ColumnWidth = 5.86
Columns("B:B").ColumnWidth = 7.71
Columns("B:B").ColumnWidth = 11
Columns("B:B").ColumnWidth = 13
Columns("B:B").ColumnWidth = 14.86
Columns("B:B").ColumnWidth = 16.43
Columns("A:A").ColumnWidth = 2.71
Columns("D:D").ColumnWidth = 16.14
Columns("B:B").ColumnWidth = 12.57
Columns("B:B").ColumnWidth = 14
'acum stergem restul de pagini si o redenumim pe cea principala.
'Sheets("Sheet2").Select
'ActiveWindow.SelectedSheets.Delete
'Sheets("Sheet3").Select
'ActiveWindow.SelectedSheets.Delete
'Range("B30").Select
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Sablon citiri"
'acum se va salva registrul.
ActiveWorkbook.Save
Call MsgBox("Operatia s-a incheiat.", vbInformation, "Finalizare")
End With
End Sub
The first bold code generates me a excel file like: file_date, but the problem is when the file is automatic opened by the code his searching somethin like this: file_date.xls.
The second code bolded wants to open my excel file with the name file_date.xls...but i dont know how to modify the code to search files with date included in their names :(..
code:
Windows("Calea 13 Septembrie_Sablon citiri_date.xls").Activate
how to make him open that file?
Pls help me.
10x.
The code is:
Sub Export()
Workbooks.Add
'aici trebuie sa pun manual alta locatie.
ActiveWorkbook.SaveAs Filename:= _
"D:\Sablon citiri\Calea 13 Septembrie_Sablon citiri " & Format(Date, "dd-mm-yyyy") & ".xls", FileFormat:= _
xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Call MsgBox("Va rog sa asteptati pana se creeaza registrul de lucru. Multumesc!", vbInformation, "Creare sablon")
Windows("Asociatia 13 Septembrie_Dl.Teodorescu.xlsm").Activate
Columns("B:G").Select
Selection.Copy
Windows("Calea 13 Septembrie_Sablon citiri.xls").Activate
Range("B1").Select
ActiveSheet.Paste
Range("I5").Select
Application.CutCopyMode = False
Cells.Select
' in urmatoarea procedura se va schimba fundalul sheet-ului.
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
'acum se va copia tabelul.
Columns("B:B").ColumnWidth = 5.86
Columns("B:B").ColumnWidth = 7.71
Columns("B:B").ColumnWidth = 11
Columns("B:B").ColumnWidth = 13
Columns("B:B").ColumnWidth = 14.86
Columns("B:B").ColumnWidth = 16.43
Columns("A:A").ColumnWidth = 2.71
Columns("D:D").ColumnWidth = 16.14
Columns("B:B").ColumnWidth = 12.57
Columns("B:B").ColumnWidth = 14
'acum stergem restul de pagini si o redenumim pe cea principala.
'Sheets("Sheet2").Select
'ActiveWindow.SelectedSheets.Delete
'Sheets("Sheet3").Select
'ActiveWindow.SelectedSheets.Delete
'Range("B30").Select
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Sablon citiri"
'acum se va salva registrul.
ActiveWorkbook.Save
Call MsgBox("Operatia s-a incheiat.", vbInformation, "Finalizare")
End With
End Sub
The first bold code generates me a excel file like: file_date, but the problem is when the file is automatic opened by the code his searching somethin like this: file_date.xls.
The second code bolded wants to open my excel file with the name file_date.xls...but i dont know how to modify the code to search files with date included in their names :(..
code:
Windows("Calea 13 Septembrie_Sablon citiri_date.xls").Activate
how to make him open that file?
Pls help me.
10x.