Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/05/2010, 07:34
Avatar de kakashi20
kakashi20
 
Fecha de Ingreso: septiembre-2009
Mensajes: 616
Antigüedad: 14 años, 7 meses
Puntos: 15
Exclamación Respuesta: ayuda SaveAs excel vb2005

Aqui esta el codigo completo, si me pueden ayudar se los agradeceria


Appl = New Microsoft.Office.Interop.Excel.Application
Libro = Appl.Workbooks.Open(My.Application.Info.DirectoryP ath & "\Formatos\formato_xparameters.xls")
Appl.DisplayAlerts = False
hoja1 = Libro.Worksheets(1)

'Le das el nombre del archivo y donde lo vas a guardar
nom = "x-parameters2G"
folder = "C:\Documents and Settings\jdgomezvi\Mis documentos\Programas vb6\CCT X parameters\"

Call BDSitesBD()

sql = "Delete * From Mapper_Vinc2"
rs = New OleDb.OleDbCommand(sql, Conn2)
rs.ExecuteNonQuery()

'insertas el mapper en la tabla
sql = "INSERT INTO Mapper_Vinc2 SELECT * FROM [Excel 8.0;DATABASE=\\bqaingrfdata\Ingenieria\Backup_Data bases\BD_Sites\Mapper.xls].[Mapper$]"
rs = New OleDb.OleDbCommand(sql, Conn2)
rs.ExecuteNonQuery()

sql = "SELECT BSC, Sitio, Mapper_Vinc2.[MTX Site ID], Mapper_Vinc2.[Cell Id], Mapper_Vinc2.[Lac ID], Latitud, Longitud, Mapper_Vinc2.[Orientacion Antena] FROM Mapper_Vinc2 WHERE Mapper_Vinc2.[MTX Site ID] <> '' AND Left$(Mapper_Vinc2.[Sitio],2) = 'GQ' or Left$(Mapper_Vinc2.[Sitio],2) = 'GS' ORDER BY Mapper_Vinc2.[MTX Site ID]"
rs = New OleDb.OleDbCommand(sql, Conn2)
dr = rs.ExecuteReader

hoja1.Activate()
i = 2
While dr.Read

hoja1.Cells(i, 1) = dr("BSC") & "," & dr("Sitio") & "," & dr("MTX Site ID") & ",732-123-" & dr("Lac ID") & "-" & dr("Cell Id") & ",2G," & dr("Latitud") & "," & dr("Longitud") & "," & dr("Orientacion Antena")
i = i + 1

End While


"Libro.SaveAs(Filename:=folder & nom & "_csv.txt", FileFormat:=xlText, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False)"

rs.Connection.Close()

MsgBox("Listo")