Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - salvataggio nuovo file exel
Forum - Visual Basic 6 - salvataggio nuovo file exel

Pagine: [ 1 2 ] Precedente | Prossimo
Avatar
moet (Normal User)
Pro


Messaggi: 185
Iscritto: 13/11/2007

Segnala al moderatore
Postato alle 15:01
Sabato, 24/01/2009
Ciao a tutti !

Ho creato un programma che compila un file excel gia esistente e me ne dovrebbe salvare una copia nuova con il nome del cliente in una sotto cartella dal nome schede riparazione.

in realta' al momento del salvataggio si apre la cartella dove risiede il file gia esistente( e non nella sottocartella schede riparazione) ed invece di uscirmi il nome del cliente mi esce "copia di riparazione.xls"

probabilmente devo cambiare le istruzioni di salvataggio ma chiedo aiuto ! :)

vorrei lasciare il file "base" riparazione.xls e il nuovo nella sottocartella.

Grazie

Codice sorgente - presumibilmente VB.NET

  1. Dim oldname As String
  2. Dim newname As String
  3.  
  4. Dim XLS As New Excel.Application
  5.     With XLS
  6.         .Workbooks.Open App.Path & "\riparazione.xls"
  7.  
  8. 'istruzioni
  9.  
  10.         .Visible = False
  11.        
  12.  
  13.        
  14.        
  15.        
  16.  
  17.         .SaveWorkspace App.Path & "\SCHEDE DI RIPARAZIONE\" & txtcliente.Text & ".xls"
  18.          MsgBox "FILE CLIENTE: " & txtcliente & " SALVATO CON SUCCESSO ", , "GARAGE MARCO"


Ultima modifica effettuata da moet il 24/01/2009 alle 15:02
PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 18:08
Sabato, 24/01/2009
mm...nn ho molta dimestichezza con excel...comunque se ho capito bene tu prima di modificare un file excel lo vorresti salvare in una cartella...cioè fare una sorta di copia di backup, giusto?

Se si prova ad usare:
Codice sorgente - presumibilmente Plain Text

  1. FileCopy app.path & "\riparazione.xls", app.path & "\tuaCartella\nuovonome.xls"


Ultima modifica effettuata da GrG il 24/01/2009 alle 18:09
PM Quote
Avatar
tippolo (Normal User)
Pro


Messaggi: 157
Iscritto: 21/09/2008

Segnala al moderatore
Postato alle 21:52
Sabato, 24/01/2009
Testo quotato

Postato originariamente da moet:

Ciao a tutti !

Ho creato un programma che compila un file excel gia esistente e me ne dovrebbe salvare una copia nuova con il nome del cliente in una sotto cartella dal nome schede riparazione.




Ciao ho sottomano una sub di un progetto che ho fatto un po di tempo fa
Codice sorgente - presumibilmente Delphi

  1. Private Sub mnuSalva_Click()
  2. 'salva il file col cognome e nome precedentemente inseriti
  3. cdgSalva.ShowSave
  4.    If cdgSalva.FileName <> "" Then
  5.          FileExcel.SaveAs cdgSalva.FileName & " " & ExcelObj.Label1
  6.    End If
  7. End Sub


cdgSalva = commondialog
in label1 c'è il nominativo
Vedi un pò di modificarla in base alle tue esigenze. Cartella, sottocartella...

Ultima modifica effettuata da tippolo il 24/01/2009 alle 21:52
PM Quote
Avatar
moet (Normal User)
Pro


Messaggi: 185
Iscritto: 13/11/2007

Segnala al moderatore
Postato alle 21:07
Lunedì, 26/01/2009
Niente da fare non sono riuscito ne con il file copy ne con la common...

altre idee ?!?!? :) :rotfl:

PM Quote
Avatar
P4p3r0g4 (Member)
Guru


Messaggi: 1319
Iscritto: 29/12/2006

Segnala al moderatore
Postato alle 21:20
Lunedì, 26/01/2009
con open .. get.. close?
ma e` molto piu facile con il filecopy.
e se non funziona e` perche hai sbagliato qualcosa nel codice.

PM Quote
Avatar
moet (Normal User)
Pro


Messaggi: 185
Iscritto: 13/11/2007

Segnala al moderatore
Postato alle 21:29
Lunedì, 26/01/2009
Provo a postarlo!

PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 21:33
Lunedì, 26/01/2009
che sistema operativo hai?

PM Quote
Avatar
moet (Normal User)
Pro


Messaggi: 185
Iscritto: 13/11/2007

Segnala al moderatore
Postato alle 21:34
Lunedì, 26/01/2009
lo posto tutto !!!

E' una scheda di riparazione di un meccanico.

Con dati cliente e la lista dei lavori eseguiti.


Codice sorgente - presumibilmente VB.NET

  1. Private Sub Cmdsalva_Click()
  2. Dim oldname As String
  3. Dim newname As String
  4.  
  5. Dim XLS As New Excel.Application
  6.     With XLS
  7.         .Workbooks.Open App.Path & "\riparazione.xls"
  8.        
  9.         'oldname = App.Path & "\riparazione.xls"
  10.        
  11.        
  12.         .Worksheets(1).Select
  13.        
  14.         .Range("C4").Select
  15.  
  16.         .ActiveCell.Value = txtcliente.Text
  17.        
  18.         .Range("C6").Select
  19.  
  20.         .ActiveCell.Value = txtindirizzo.Text
  21.        
  22.         .Range("B8").Select
  23.  
  24.         .ActiveCell.Value = txtcitta.Text
  25.        
  26.         .Range("F8").Select
  27.  
  28.         .ActiveCell.Value = txttelefono.Text   'Label5.Caption
  29.        
  30.         .Range("B10").Select
  31.  
  32.         .ActiveCell.Value = txtvettura.Text
  33.        
  34.         .Range("F10").Select
  35.  
  36.         .ActiveCell.Value = txtkm.Text
  37.        
  38.         .Range("B12").Select
  39.  
  40.         .ActiveCell.Value = txttarga.Text
  41.        
  42.         .Range("F12").Select
  43.  
  44.         .ActiveCell.Value = txtmotore.Text
  45.        
  46.        
  47.        
  48.         .Range("A16").Select
  49.         .ActiveCell.Value = txtq1.Text
  50.         .Range("B16").Select
  51.         .ActiveCell.Value = txtd1.Text
  52.         .Range("I16").Select
  53.         .ActiveCell.Value = txteuro1.Text
  54.        
  55.         .Range("A17").Select
  56.         .ActiveCell.Value = txtq2.Text
  57.         .Range("B17").Select
  58.         .ActiveCell.Value = txtd2.Text
  59.         .Range("I17").Select
  60.         .ActiveCell.Value = txteuro2.Text
  61.        
  62.         .Range("A18").Select
  63.         .ActiveCell.Value = txtq3.Text
  64.         .Range("B18").Select
  65.         .ActiveCell.Value = txtd3.Text
  66.         .Range("I18").Select
  67.         .ActiveCell.Value = txteuro3.Text
  68.        
  69.         .Range("A19").Select
  70.         .ActiveCell.Value = txtq4.Text
  71.         .Range("B19").Select
  72.         .ActiveCell.Value = txtd4.Text
  73.         .Range("I19").Select
  74.         .ActiveCell.Value = txteuro4.Text
  75.        
  76.         .Range("A20").Select
  77.         .ActiveCell.Value = txtq5.Text
  78.         .Range("B20").Select
  79.         .ActiveCell.Value = txtd5.Text
  80.         .Range("I20").Select
  81.         .ActiveCell.Value = txteuro5.Text
  82.        
  83.         .Range("A21").Select
  84.         .ActiveCell.Value = txtq6.Text
  85.         .Range("B21").Select
  86.         .ActiveCell.Value = txtd6.Text
  87.         .Range("I21").Select
  88.         .ActiveCell.Value = txteuro6.Text
  89.        
  90.         .Range("A22").Select
  91.         .ActiveCell.Value = txtq7.Text
  92.         .Range("B22").Select
  93.         .ActiveCell.Value = txtd7.Text
  94.         .Range("I22").Select
  95.         .ActiveCell.Value = txteuro7.Text
  96.        
  97.         .Range("A23").Select
  98.         .ActiveCell.Value = txtq8.Text
  99.         .Range("B23").Select
  100.         .ActiveCell.Value = txtd8.Text
  101.         .Range("I23").Select
  102.         .ActiveCell.Value = txteuro8.Text
  103.        
  104.         .Range("A24").Select
  105.         .ActiveCell.Value = txtq9.Text
  106.         .Range("B24").Select
  107.         .ActiveCell.Value = txtd9.Text
  108.         .Range("I24").Select
  109.         .ActiveCell.Value = txteuro9.Text
  110.        
  111.         .Range("A25").Select
  112.         .ActiveCell.Value = txtq10.Text
  113.         .Range("B25").Select
  114.         .ActiveCell.Value = txtd10.Text
  115.         .Range("I25").Select
  116.         .ActiveCell.Value = txteuro10.Text
  117.        
  118.         .Range("A26").Select
  119.         .ActiveCell.Value = txtq11.Text
  120.         .Range("B26").Select
  121.         .ActiveCell.Value = txtd11.Text
  122.         .Range("I26").Select
  123.         .ActiveCell.Value = txteuro11.Text
  124.        
  125.         .Range("A27").Select
  126.         .ActiveCell.Value = txtq12.Text
  127.         .Range("B27").Select
  128.         .ActiveCell.Value = txtd12.Text
  129.         .Range("I27").Select
  130.         .ActiveCell.Value = txteuro12.Text
  131.        
  132.         .Range("I36").Select
  133.         .ActiveCell.Value = txtimponibile.Text
  134.         .Range("I37").Select
  135.         .ActiveCell.Value = txtiva.Text
  136.         .Range("I38").Select
  137.         .ActiveCell.Value = txttotale.Text
  138.        
  139.        
  140.         .Visible = False 'true
  141.        
  142.          
  143.  
  144.        
  145.         'newname = App.Path & "\SCHEDE DI RIPARAZIONE\" & txtcliente.Text & ".xls"
  146.  
  147.         .SaveWorkspace App.Path & "\SCHEDE DI RIPARAZIONE\" & txtcliente.Text & ".xls"
  148.        
  149.          MsgBox "FILE CLIENTE: " & txtcliente & " SALVATO CON SUCCESSO ", , "GARAGE MARCO"
  150.     End With
  151. 'XLS.Workbooks(1).Close true
  152. ' mandalo in stampa
  153. End Sub


PM Quote
Avatar
moet (Normal User)
Pro


Messaggi: 185
Iscritto: 13/11/2007

Segnala al moderatore
Postato alle 21:37
Lunedì, 26/01/2009
windows xp sp.2

PM Quote
Pagine: [ 1 2 ] Precedente | Prossimo