Telefonino.net network
 
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. NEI PREFERITI .:: | RSS Forum | RSS News | NEWS web | NEWS software |
| PUBBLICITA' | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | CERCA nel FORUM » |

Torna indietro   WinTricks Forum > Software > Programmazione

Notices

Rispondi
 
Strumenti discussione
Vecchio 30-12-2017, 19.03.26   #1
jjvincentevb6
Newbie
 
Registrato: 30-12-2017
Messaggi: 1
jjvincentevb6 promette bene
Talking [VB6]Aggiornare Query Web (Excel)

Salve a tutti


avrei un foglio excel (prima lo apro in excel (esiste una query web che preleva i dati(classifica campionato argentino)))

poi apro il sorgente vb6 e li carica su' una msflexgrid poi su' un commandbutton aggiorna campionato

come potrei fare dal sorgente vb6?per farlo aggiornare senza chiudere il sorgente ed aggiornare da excel?

Ringrazio per una cortese risposta...

allego un po' di codice

Quota:
Private Sub ARG_Click()
Dim s As Integer
Dim x As Integer
Dim j As Integer
Dim z As Integer


MSFlexGrid1.Rows = 30
MSFlexGrid1.Cols = 20
MSFlexGrid1.TextMatrix(0, 0) = "Po"

MSFlexGrid1.TextMatrix(0, 1) = "Squadra"
MSFlexGrid1.TextMatrix(0, 2) = "Pu"
MSFlexGrid1.TextMatrix(0, 3) = "Puc"
MSFlexGrid1.TextMatrix(0, 4) = "Puf"
MSFlexGrid1.TextMatrix(0, 5) = "Gio"
MSFlexGrid1.TextMatrix(0, 6) = "Pe"
MSFlexGrid1.TextMatrix(0, 7) = "Rf"
MSFlexGrid1.TextMatrix(0, 8) = "Rs"
MSFlexGrid1.TextMatrix(0, 9) = "Vc"
MSFlexGrid1.TextMatrix(0, 10) = "Nc"
MSFlexGrid1.TextMatrix(0, 11) = "Pc"
MSFlexGrid1.TextMatrix(0, 12) = "Gc"
MSFlexGrid1.TextMatrix(0, 13) = "Sc"
MSFlexGrid1.TextMatrix(0, 14) = "Vf"
MSFlexGrid1.TextMatrix(0, 15) = "Nf"
MSFlexGrid1.TextMatrix(0, 16) = "Pf"
MSFlexGrid1.TextMatrix(0, 17) = "Gf"
MSFlexGrid1.TextMatrix(0, 18) = "Sf"
MSFlexGrid1.ColWidth(1) = 2000
MSFlexGrid1.ColWidth(2) = 450
MSFlexGrid1.ColWidth(3) = 450
MSFlexGrid1.ColWidth(4) = 450
MSFlexGrid1.ColWidth(5) = 450
MSFlexGrid1.ColWidth(6) = 450
MSFlexGrid1.ColWidth(7) = 450
MSFlexGrid1.ColWidth(8) = 450
MSFlexGrid1.ColWidth(9) = 450
MSFlexGrid1.ColWidth(10) = 450
MSFlexGrid1.ColWidth(11) = 450
MSFlexGrid1.ColWidth(12) = 450
MSFlexGrid1.ColWidth(13) = 450
MSFlexGrid1.ColWidth(14) = 450
MSFlexGrid1.ColWidth(15) = 450
MSFlexGrid1.ColWidth(16) = 450
MSFlexGrid1.ColWidth(17) = 450
MSFlexGrid1.ColWidth(18) = 450

MSFlexGrid1.Width = 10150
MSFlexGrid1.Height = 7400

For s = 1 To 28
MSFlexGrid1.TextMatrix(s, 0) = s
Next
If VerifyFile(App.Path & "\ARGENTINA1.xls") Then

'imposto la variabile oggetto FileExcel con il nome del file xls
Set FileExcel = Excel.Workbooks.Open(App.Path & "\ARGENTINA1.xls")
Else
MsgBox "Impossibile eseguire il programma" & _
vbCrLf & "Il file " & App.Path & "\ARGENTINA1.xls" & " non è stato trovato.", vbOKOnly
End
End If
'**************** Esempio 1 *****************************
'legge il contenuto di una cella in un foglio di excel
On Error GoTo errore
'imposto la variabile oggetto FoglioExcel con il nome del foglio da leggere
Set FoglioExcel = FileExcel.Worksheets("FOGLIO1")

'imposto la variabile oggetto CellaFoglioExcel puntanto alla riga2,colonna1
Set CellaFoglioExcel = FoglioExcel.Cells(3, 1)
Set CellaFoglioExcel1 = FoglioExcel.Cells(4, 1)
Set CellaFoglioExcel2 = FoglioExcel.Cells(5, 1)
Set CellaFoglioExcel3 = FoglioExcel.Cells(6, 1)
Set CellaFoglioExcel4 = FoglioExcel.Cells(7, 1)
Set CellaFoglioExcel5 = FoglioExcel.Cells(8, 1)
Set CellaFoglioExcel6 = FoglioExcel.Cells(9, 1)
Set CellaFoglioExcel7 = FoglioExcel.Cells(10, 1)
Set CellaFoglioExcel8 = FoglioExcel.Cells(11, 1)
Set CellaFoglioExcel9 = FoglioExcel.Cells(12, 1)
Set CellaFoglioExcel10 = FoglioExcel.Cells(13, 1)
Set CellaFoglioExcel11 = FoglioExcel.Cells(14, 1)
Set CellaFoglioExcel12 = FoglioExcel.Cells(15, 1)
Set CellaFoglioExcel13 = FoglioExcel.Cells(16, 1)
Set CellaFoglioExcel14 = FoglioExcel.Cells(17, 1)
Set CellaFoglioExcel15 = FoglioExcel.Cells(18, 1)
Set CellaFoglioExcel16 = FoglioExcel.Cells(19, 1)
Set CellaFoglioExcel17 = FoglioExcel.Cells(20, 1)
Set CellaFoglioExcel18 = FoglioExcel.Cells(21, 1)
Set CellaFoglioExcel19 = FoglioExcel.Cells(22, 1)
Set CellaFoglioExcel20 = FoglioExcel.Cells(23, 1)
Set CellaFoglioExcel21 = FoglioExcel.Cells(24, 1)
Set CellaFoglioExcel22 = FoglioExcel.Cells(25, 1)
Set CellaFoglioExcel23 = FoglioExcel.Cells(26, 1)
Set CellaFoglioExcel24 = FoglioExcel.Cells(27, 1)
Set CellaFoglioExcel25 = FoglioExcel.Cells(28, 1)
Set CellaFoglioExcel26 = FoglioExcel.Cells(29, 1)
Set CellaFoglioExcel27 = FoglioExcel.Cells(30, 1)
Set CellaFoglioExcel28 = FoglioExcel.Cells(31, 1)
Set CellaFoglioExcel29 = FoglioExcel.Cells(39, 6)









'In alternativa è possibile usare anche questa sintassi
'Set CellaFoglioExcel = FoglioExcel.Range("A2")

'leggo il contenuto della cella A2 (colonna1,riga2)
MSFlexGrid1.TextMatrix(1, 1) = CellaFoglioExcel.Value
MSFlexGrid1.TextMatrix(2, 1) = CellaFoglioExcel1.Value
MSFlexGrid1.TextMatrix(3, 1) = CellaFoglioExcel2.Value
MSFlexGrid1.TextMatrix(4, 1) = CellaFoglioExcel3.Value
MSFlexGrid1.TextMatrix(5, 1) = CellaFoglioExcel4.Value
MSFlexGrid1.TextMatrix(6, 1) = CellaFoglioExcel5.Value
MSFlexGrid1.TextMatrix(7, 1) = CellaFoglioExcel6.Value
MSFlexGrid1.TextMatrix(8, 1) = CellaFoglioExcel7.Value
MSFlexGrid1.TextMatrix(9, 1) = CellaFoglioExcel8.Value
MSFlexGrid1.TextMatrix(10, 1) = CellaFoglioExcel9.Value
MSFlexGrid1.TextMatrix(11, 1) = CellaFoglioExcel10.Value
MSFlexGrid1.TextMatrix(12, 1) = CellaFoglioExcel11.Value
MSFlexGrid1.TextMatrix(13, 1) = CellaFoglioExcel12.Value
MSFlexGrid1.TextMatrix(14, 1) = CellaFoglioExcel13.Value
MSFlexGrid1.TextMatrix(15, 1) = CellaFoglioExcel14.Value
MSFlexGrid1.TextMatrix(16, 1) = CellaFoglioExcel15.Value
MSFlexGrid1.TextMatrix(17, 1) = CellaFoglioExcel16.Value
MSFlexGrid1.TextMatrix(18, 1) = CellaFoglioExcel17.Value
MSFlexGrid1.TextMatrix(19, 1) = CellaFoglioExcel18.Value
MSFlexGrid1.TextMatrix(20, 1) = CellaFoglioExcel19.Value
MSFlexGrid1.TextMatrix(21, 1) = CellaFoglioExcel20.Value
MSFlexGrid1.TextMatrix(22, 1) = CellaFoglioExcel21.Value
MSFlexGrid1.TextMatrix(23, 1) = CellaFoglioExcel22.Value
MSFlexGrid1.TextMatrix(24, 1) = CellaFoglioExcel23.Value
MSFlexGrid1.TextMatrix(25, 1) = CellaFoglioExcel24.Value
MSFlexGrid1.TextMatrix(26, 1) = CellaFoglioExcel25.Value
MSFlexGrid1.TextMatrix(27, 1) = CellaFoglioExcel26.Value
MSFlexGrid1.TextMatrix(28, 1) = CellaFoglioExcel27.Value
Combo1.AddItem CellaFoglioExcel.Value
Combo1.AddItem CellaFoglioExcel1.Value
Combo1.AddItem CellaFoglioExcel2.Value
Combo1.AddItem CellaFoglioExcel3.Value
Combo1.AddItem CellaFoglioExcel4.Value
Combo1.AddItem CellaFoglioExcel5.Value
Combo1.AddItem CellaFoglioExcel6.Value
Combo1.AddItem CellaFoglioExcel7.Value
Combo1.AddItem CellaFoglioExcel8.Value
Combo1.AddItem CellaFoglioExcel9.Value
Combo1.AddItem CellaFoglioExcel10.Value
Combo1.AddItem CellaFoglioExcel11.Value
Combo1.AddItem CellaFoglioExcel12.Value
Combo1.AddItem CellaFoglioExcel13.Value
Combo1.AddItem CellaFoglioExcel14.Value
Combo1.AddItem CellaFoglioExcel15.Value
Combo1.AddItem CellaFoglioExcel16.Value
Combo1.AddItem CellaFoglioExcel17.Value
Combo1.AddItem CellaFoglioExcel18.Value
Combo1.AddItem CellaFoglioExcel19.Value
Combo1.AddItem CellaFoglioExcel20.Value
Combo1.AddItem CellaFoglioExcel21.Value
Combo1.AddItem CellaFoglioExcel22.Value
Combo1.AddItem CellaFoglioExcel23.Value
Combo1.AddItem CellaFoglioExcel24.Value
Combo1.AddItem CellaFoglioExcel25.Value
Combo1.AddItem CellaFoglioExcel26.Value
Combo1.AddItem CellaFoglioExcel27.Value

Combo2.AddItem CellaFoglioExcel.Value
Combo2.AddItem CellaFoglioExcel1.Value
Combo2.AddItem CellaFoglioExcel2.Value
Combo2.AddItem CellaFoglioExcel3.Value
Combo2.AddItem CellaFoglioExcel4.Value
Combo2.AddItem CellaFoglioExcel5.Value
Combo2.AddItem CellaFoglioExcel6.Value
Combo2.AddItem CellaFoglioExcel7.Value
Combo2.AddItem CellaFoglioExcel8.Value
Combo2.AddItem CellaFoglioExcel9.Value
Combo2.AddItem CellaFoglioExcel10.Value
Combo2.AddItem CellaFoglioExcel11.Value
Combo2.AddItem CellaFoglioExcel12.Value
Combo2.AddItem CellaFoglioExcel13.Value
Combo2.AddItem CellaFoglioExcel14.Value
Combo2.AddItem CellaFoglioExcel15.Value
Combo2.AddItem CellaFoglioExcel16.Value
Combo2.AddItem CellaFoglioExcel17.Value
Combo2.AddItem CellaFoglioExcel18.Value
Combo2.AddItem CellaFoglioExcel19.Value
Combo2.AddItem CellaFoglioExcel20.Value
Combo2.AddItem CellaFoglioExcel21.Value
Combo2.AddItem CellaFoglioExcel22.Value
Combo2.AddItem CellaFoglioExcel23.Value
Combo2.AddItem CellaFoglioExcel24.Value
Combo2.AddItem CellaFoglioExcel25.Value
Combo2.AddItem CellaFoglioExcel26.Value
Combo2.AddItem CellaFoglioExcel27.Value


For x = 1 To 16
Set Squadra1ex(x) = FoglioExcel.Cells(3, x)

Set Squadra2ex(x) = FoglioExcel.Cells(4, x)
Set Squadra3ex(x) = FoglioExcel.Cells(5, x)
Set Squadra4ex(x) = FoglioExcel.Cells(6, x)
Set Squadra5ex(x) = FoglioExcel.Cells(7, x)
Set Squadra6ex(x) = FoglioExcel.Cells(8, x)
Set Squadra7ex(x) = FoglioExcel.Cells(9, x)
Set Squadra8ex(x) = FoglioExcel.Cells(10, x)
Set Squadra9ex(x) = FoglioExcel.Cells(11, x)
Set Squadra10ex(x) = FoglioExcel.Cells(12, x)
Set Squadra11ex(x) = FoglioExcel.Cells(13, x)
Set Squadra12ex(x) = FoglioExcel.Cells(14, x)
Set Squadra13ex(x) = FoglioExcel.Cells(15, x)
Set Squadra14ex(x) = FoglioExcel.Cells(16, x)
Set Squadra15ex(x) = FoglioExcel.Cells(17, x)
Set Squadra16ex(x) = FoglioExcel.Cells(18, x)
Set Squadra17ex(x) = FoglioExcel.Cells(19, x)
Set Squadra18ex(x) = FoglioExcel.Cells(20, x)
Set Squadra19ex(x) = FoglioExcel.Cells(21, x)
Set Squadra20ex(x) = FoglioExcel.Cells(22, x)
Set Squadra21ex(x) = FoglioExcel.Cells(23, x)
Set Squadra22ex(x) = FoglioExcel.Cells(24, x)
Set Squadra23ex(x) = FoglioExcel.Cells(25, x)
Set Squadra24ex(x) = FoglioExcel.Cells(26, x)
Set Squadra25ex(x) = FoglioExcel.Cells(27, x)
Set Squadra26ex(x) = FoglioExcel.Cells(28, x)
Set Squadra27ex(x) = FoglioExcel.Cells(29, x)
Set Squadra28ex(x) = FoglioExcel.Cells(30, x)


MSFlexGrid1.TextMatrix(1, x) = Squadra1ex(x)
MSFlexGrid1.TextMatrix(2, x) = Squadra2ex(x)
MSFlexGrid1.TextMatrix(3, x) = Squadra3ex(x)
MSFlexGrid1.TextMatrix(4, x) = Squadra4ex(x)
MSFlexGrid1.TextMatrix(5, x) = Squadra5ex(x)
MSFlexGrid1.TextMatrix(6, x) = Squadra6ex(x)
MSFlexGrid1.TextMatrix(7, x) = Squadra7ex(x)
MSFlexGrid1.TextMatrix(8, x) = Squadra8ex(x)
MSFlexGrid1.TextMatrix(9, x) = Squadra9ex(x)
MSFlexGrid1.TextMatrix(10, x) = Squadra10ex(x)
MSFlexGrid1.TextMatrix(11, x) = Squadra11ex(x)
MSFlexGrid1.TextMatrix(12, x) = Squadra12ex(x)
MSFlexGrid1.TextMatrix(13, x) = Squadra13ex(x)
MSFlexGrid1.TextMatrix(14, x) = Squadra14ex(x)
MSFlexGrid1.TextMatrix(15, x) = Squadra15ex(x)
MSFlexGrid1.TextMatrix(16, x) = Squadra16ex(x)
MSFlexGrid1.TextMatrix(17, x) = Squadra17ex(x)
MSFlexGrid1.TextMatrix(18, x) = Squadra18ex(x)
MSFlexGrid1.TextMatrix(19, x) = Squadra19ex(x)
MSFlexGrid1.TextMatrix(20, x) = Squadra20ex(x)
MSFlexGrid1.TextMatrix(21, x) = Squadra21ex(x)
MSFlexGrid1.TextMatrix(22, x) = Squadra22ex(x)
MSFlexGrid1.TextMatrix(23, x) = Squadra23ex(x)
MSFlexGrid1.TextMatrix(24, x) = Squadra24ex(x)
MSFlexGrid1.TextMatrix(25, x) = Squadra25ex(x)
MSFlexGrid1.TextMatrix(26, x) = Squadra26ex(x)
MSFlexGrid1.TextMatrix(27, x) = Squadra27ex(x)
MSFlexGrid1.TextMatrix(28, x) = Squadra28ex(x)


Next

MSFlexGrid1.Visible = True







'libero ("scarico") le variabili
Set CellaFoglioExcel = Nothing
Set FoglioExcel = Nothing
MSFlexGrid1.ColWidth(1) = 2000
'In alternativa è possibile evitare di impostare le variabili oggetto
'FoglioExcel e CellaFoglioExcel usando la seguente sintassi:
'Label1 = FileExcel.Worksheets("CAP").Cells(2, 1)
Exit Sub

errore:
MsgBox "Errore " & Err.Number & vbCrLf & Err.Description
Set CellaFoglioExcel = Nothing
Set FoglioExcel = Nothing
Form_Unload (False)
End Sub

Public Function VerifyFile(FileName As String)
On Error Resume Next
Open FileName For Input As #1
If Err Then
VerifyFile = False
Exit Function
End If
Close #1
VerifyFile = True
End Function




jjvincentevb6 non è collegato   Rispondi citando
Rispondi


Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti)
 
Strumenti discussione

Regole di scrittura
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is ON
Gli smilies sono ON
[IMG] è ON
Il codice HTML è OFF

Vai al forum

Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
Corso VBA Alexsandra Guide 85 16-11-2016 12.11.51
Laboratorio di VBA: Programmi e file sorgenti Alexsandra Guide 17 16-03-2016 21.33.27
Codice Access per esportare query in Excel stefaniamilano Office suite 3 03-06-2014 20.02.40
excel query -macro manuel30 Office suite 0 05-09-2004 10.41.51

Orario GMT +2. Ora sono le: 22.47.35.


E' vietata la riproduzione, anche solo in parte, di contenuti e grafica.
Copyright © 1999-2017 Edizioni Master S.p.A. p.iva: 02105820787 • Tutti i diritti sono riservati
L'editore NON si assume nessuna responsabilità dei contenuti pubblicati sul forum in quanto redatti direttamente dagli utenti.
Questi ultimi sono responsabili dei contenuti da loro riportati nelle discussioni del forum
Powered by vBulletin - 2010 Copyright © Jelsoft Enterprises Limited.