| | Post: 438 | Registrato il: 18/02/2010
| Città: MILANO | Età: 28 | Utente Senior | excel 2003 / 2007 | | OFFLINE | |
|
20/02/2015 20:06 | |
Salve,
come posso aprire due file excel?
Mi spiego apro il primo file e conteporaneamnte deve aprirsi il secondo che è collegato al primo con delle formule cerca.vert.
Alla chiususa del primo deve chiudersi anche il secondo file.
Spero di essermi spiegato.
xam -------------------------------
excel 2003 ufficio / 2007 casa |
|
| | Post: 470 | Registrato il: 21/06/2013
| Città: NAPOLI | Età: 70 | Utente Senior | Excel 365 | | ONLINE |
|
20/02/2015 20:15 | |
Ciao
Io farei così (ma non ho provato).
Registrerei due macro aprendo e chiudendo il secondo file
Poi nel primo file in Workbook_Open richiamerei la macro di apertura es. Call apertura.
Infine all'evento BeforeClose assocerei Call chiusura.
Alfredo |
| | Post: 896 | Registrato il: 27/06/2011
| Utente Senior | excel 2007 | | OFFLINE |
|
20/02/2015 20:30 | |
xam99, 20/02/2015 20:06:
Salve,
come posso aprire due file excel?
Mi spiego apro il primo file e conteporaneamnte deve aprirsi il secondo che è collegato al primo con delle formule cerca.vert.
Alla chiususa del primo deve chiudersi anche il secondo file.
Spero di essermi spiegato.
xam
ciao a tutti
ciao Max,
io credo che per chiudere il secondo chiudendo il primo,
basti un
nel Before.close del primo
e per aprire il secondo un Workbooks.Open Filename:="c:\tuopercorso\nomefile.xxx" 'aggiusta l'estensione
nel workbook.open del primo
avevo dimenticato le virglette dopo l'estensione...
Un saluto ad Alfredo
Frank
[Modificato da tanimon 20/02/2015 20:57]
Stretta la foglia, larga la via, dite la vostra che ho detto la mia.
Excel 2007 forse anche 2013 ... 2021 ... 365 e future... |
| | Post: 438 | Registrato il: 18/02/2010
| Città: MILANO | Età: 28 | Utente Senior | excel 2003 / 2007 | | OFFLINE | |
|
21/02/2015 10:39 | |
Ciao,
nel desktop ho una cartella "verniciatura_1" con dentro due file excel:
1 verniciatura
2 gestionale
nel file verniciatura è inserito in thisworkbook
Private Sub Workbook_Open()
Workbooks.Open Filename:= _
"C:\Users\massimo\Desktop\verniciatura_1\gestionale.xls" '<<< apre file gestionale
Sheets("articoli").Activate
end sub
'---------------------------------------------------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Workbooks("gestionale.xls").Close 'SaveChanges:=True '<<< chiude file gestionale
End Sub
aprendo il file verniciatura si apre anche il file gestionale, e fin qui va bene.
Il probelema è alla chiusura del file verniciatura, chiudendo questo si chiude tutto senza chiedere di salvare e resta attiva la maschera principale di excel.
Un aiuto?
xam
-------------------------------
excel 2003 ufficio / 2007 casa |
| | Post: 439 | Registrato il: 18/02/2010
| Città: MILANO | Età: 28 | Utente Senior | excel 2003 / 2007 | | OFFLINE | |
|
21/02/2015 13:09 | |
Ora così:
Workbooks("gestionale.xls").Close SaveChanges:=True '<<< chiude file gestionale
alla chiusura mi chiede di salvare, si chiudono i 2 file ma resta attiva
la maschera principale di excel.
xam -------------------------------
excel 2003 ufficio / 2007 casa |
| | Post: 2.903 | Registrato il: 13/03/2012
| Città: LIVORNO | Età: 78 | Utente Veteran | 2010 | | OFFLINE | |
|
21/02/2015 14:22 | |
aggiungi
Application.Quit
----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta |
| | Post: 440 | Registrato il: 18/02/2010
| Città: MILANO | Età: 28 | Utente Senior | excel 2003 / 2007 | | OFFLINE | |
|
21/02/2015 17:28 | |
Provato:
Workbooks("gestionale.xls").Close SaveChanges:=True '<<< chiude file gestionale
Application.Quit
i due file si chiudono senza richiere salva e la maschera principale di excel resta aperta.
xam -------------------------------
excel 2003 ufficio / 2007 casa |
|
|