Mensajes: 434 Ubicación: Tachira
Viernes, 08 Agosto 2014, 05:47
OneErick
Jajajaja dígame esta parte
Citar:
If Exist(rutareport) Then Kill rutareport
Dice si encuentras un reporte con el mismo nombre ASESINARLO, dira el cliente cada ves que creo un reporte se oculta! venditos reportes tienen viiidaa se camuflaaan jajajaja.
Yo por otra parte no niego que me ha gustado y dado ideas lo único que hice fue quitarle el KILL y condicionarlo con un mensaje, si encuentra archivo decir el archivo ya existe cambie el nombre o mover de lo contrario guardarlo.
Public Sub Button_reportes_Click()
Dim ruta As String
Dim archivo As File
Dim i, j As Integer
Dim fila As String
Dim division As Float
Dim contador As Integer
ruta = User.Home &/ "Reporte de Registro de Profesores y sus Materias.html"
If Exist(ruta) Then ---------------------------------Quitar el kill y condicionarlo a un mensaje
Message.Warning("YA HAY UN REPORTE CON EL MISMO NOMBRE POR FAVOR MUEVA EL MISMO A OTRA RUTA O CAMBIE EL NOMBRE!")
Else
If Message.Question(" ¿DESEA GUARDAR UN REPORTE DE PROFESORES CON SUS MATERIAS?", "SI", "NO") = 1 Then
archivo = Open ruta For Write Create
Print #archivo, "<html>"
Print #archivo, "<head><title>Reporte de profesores y las materias que imparten</title></head>"
Print #archivo, "<body topmargin='0' leftmargin='0'"
Print #archivo, ">"
Print #archivo, "<table border='1' width='500' cellpadding='0' cellspacing='0'>"
Print #archivo, " <tr>"
Print #archivo, " <td rowspan='10' colspan='50' align='center'>"
Print #archivo, " <h3>Listado de profesores</h3>"
Print #archivo, " <tr>"
'Print #archivo, " <td colspan='20' align='center'>"
Print #archivo, " <td bgcolor= #D9D9D9 align = 'center'> <h6>Cedula</h6></td>"
Print #archivo, " <td bgcolor= #D9D9D9 align ='center'> <h6>Nombre</h6></td>"
Print #archivo, " <td bgcolor= #D9D9D9 align ='center'><h6>Direccion</h6></td>"
Print #archivo, " <td bgcolor= #D9D9D9 align ='center'> <h6>Telefono</h6></td>"
Print #archivo, " <td bgcolor= #D9D9D9 align ='center'> <h6>Codigo de Materia</h6></td>"
Print #archivo, " <td bgcolor= #D9D9D9 align ='center'> <h6>Materia</h6></td>"
Print #archivo, " </tr>"
For i = 0 To Lista.rows.Count - 1
Print #archivo, " <tr>"
For j = 0 To Lista.Columns.Count - 1
Print #archivo, " <td><h6>" & Lista[i, j].Text & "</h6></td>"
Next
Print #archivo, " </tr>"
Next
Print #archivo, "</table>"
Print #archivo, "</body>"
Print #archivo, "</html>"
Close #archivo
Message.Info("SE HA CREADO UN REPORTE EN MODO TABLA DE PROFESORES Y SUS MATERIAS (GUARDADO EN DIRECTORIO PRINCIPAL)")
Endif
Endif
End
Otra idea que esto podría dar para que no este diciendo mover o cambiar nombre, seria crear una variable string o textbox donde uno coloque el nuevo nombre y se guarde, ya eso lo tendría que probar.
A mi me esta gustando la idea de los reportes en html ya que me interesa sacar un total de todos los registros posibles en tabla pero empequeñeciendo las letras y darle color a los campos iniciales de las columnas.
Otra cosa que me ha llamado la atencion son estos codigos.
Exec ["firefox", rutareport, "Reporte"]
creo que tambien dice:
shell ["firefox", rutareport, "Reporte"]
If Exist(rutareport) Then Kill rutareport
Si yo hiciera un Direct Chooser se podria colocar en el mismo esos comando para abrir, modificar y eliminar archivos?.