Ouvrir excel avec vb en désactivant les macros et liaisons
cs_chocotte
Messages postés8Date d'inscriptionmercredi 24 novembre 2004StatutMembreDernière intervention 1 août 2005
-
13 avril 2005 à 13:46
cs_chocotte
Messages postés8Date d'inscriptionmercredi 24 novembre 2004StatutMembreDernière intervention 1 août 2005
-
13 avril 2005 à 16:47
bonjour
J'ai besoin d'aller chercher une valeur dans un fichier excel pour pouvoir ensuite l'ajouter a une base de données Sybase.
Mon fichier excel utilise les macros et à des liaisons avec d'autres fichiers.
Savez vous comment je peux ouvrir le fichier sans que les questions a propos des macros et des liaisons ne me soient posées ?
Ca doit être au niveau de l'open enfin je crois .
Merci de votre aide
Mon code est le suivant :
Dim xlApp As Object
Dim nomfichier,txt As String
mad_kad
Messages postés23Date d'inscriptionmercredi 9 février 2005StatutMembreDernière intervention22 août 2005 13 avril 2005 à 16:34
Voici un exemple qui pourrras peut être t'aider :
Public ClasseurXLS As Object
Private Sub Cmd_Importation_Click()
Dim PathFic As String
Dim NomFic As String
Dim NomFicXLS As String
Dim NomTable As String
Dim iNom_emp As String
Dim iCommentaires As String
Dim iDateJ As Date
Dim iNum_affaire As Integer
Dim iNum_phase As Integer
Dim i As Integer
Dim iNb_heures As Integer
Dim sql As String
Set dbs = CurrentDb
Set ClasseurXLS = CreateObject("Excel.application")
'Initialisation Nom du fichier à importer
If (Text1.Value <> "") Then
NomFic = Text1
NomFic = NomFic & ".xls"
Else
réponse = MsgBox("Nom du fichier à importer manquant", vbExclamation + vbOKOnly, "Attention !!!")
Exit Sub
End If
'Initialisation Emplacement du fichier à importer
If (Text2.Value <> "") Then
PathFic = Text2
Else
réponse = MsgBox("Emplacement du fichier à importer manquant", vbExclamation + vbOKOnly, "Attention !!!")
Exit Sub
End If
'Initialisation Nom de la table d'importation
If (Text3.Value <> "") Then
NomTable = Text3
Else
réponse = MsgBox("Nom de la table d'importation manquant", vbExclamation + vbOKOnly, "Attention !!!")
Exit Sub
End If
'Ouverture du classeur d'importation
ClasseurXLS.Workbooks.Open PathFic & NomFic