XL 2019 Mon Userform clignote

  • Initiateur de la discussion Initiateur de la discussion ARaul
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

ARaul

XLDnaute Junior
Bonjour chers tous.
Mon Userform clignote lorsque
  • je charge un fichier PDF (Userform 1; Bouton "Import DOC")
  • je fais afficher une ligne de mon Listview, contenant un chemin d'accès de fichier PDF (Userform 1; Listview 2)
  • Je visualise un fichier PDF (Userform1; Bouton "Ouvrir DOC")
Je sollicite vivement vos expertises
Fichier joint.
 

Pièces jointes

Bonjour ARaul,

Pour info, on n'utilise pas une procédure sous forme de FONCTION si celle-ci ne renvoie rien 🤔🫤
VB:
Function UploadPDFfile_INSCRIPTION()
  Dim pdfPath As String
  Dim fileDialog As Object
  Dim docsPDFPath As String
  Dim newPdfPath As String
  Dim fso As Object
                        
  docsPDFPath = ThisWorkbook.Path & "\docsPDF"
    
  Set fso = CreateObject("Scripting.FileSystemObject")
  If Not fso.FolderExists(docsPDFPath) Then
    fso.CreateFolder docsPDFPath
  End If
    
  Set fileDialog = Application.fileDialog(msoFileDialogFilePicker)
  fileDialog.Filters.Clear
  fileDialog.Filters.Add "PDF Files", "*.pdf", 1
    
  If fileDialog.Show = -1 Then
    pdfPath = fileDialog.SelectedItems(1)
        
    newPdfPath = docsPDFPath & "\" & fso.GetFileName(pdfPath)
        
    fso.CopyFile pdfPath, newPdfPath, True
        
    TextBox24.Value = newPdfPath
        
    WebBrowser1.Navigate newPdfPath
  End If
End Function

Et sinon, peut-être en désactivant le rafraichissement écran
Code:
Sub UploadPDFfile_INSCRIPTION()
  Dim pdfPath As String
  Dim fileDialog As Object
  Dim docsPDFPath As String
  Dim newPdfPath As String
  Dim fso As Object
  docsPDFPath = ThisWorkbook.Path & "\docsPDF"
  Set fso = CreateObject("Scripting.FileSystemObject")
  If Not fso.FolderExists(docsPDFPath) Then
    fso.CreateFolder docsPDFPath
  End If
  Set fileDialog = Application.fileDialog(msoFileDialogFilePicker)
  fileDialog.Filters.Clear
  fileDialog.Filters.Add "PDF Files", "*.pdf", 1
  If fileDialog.Show = -1 Then
    ' Désactiver l'écran
    Application.ScreenUpdating = False
    ' La suite
    pdfPath = fileDialog.SelectedItems(1)
    newPdfPath = docsPDFPath & "\" & fso.GetFileName(pdfPath)
    fso.CopyFile pdfPath, newPdfPath, True
    TextBox24.Value = newPdfPath
    WebBrowser1.Navigate newPdfPath
    ' Réactiver l'écran
    Application.ScreenUpdating = True
  End If
End Sub

A+
 
Bonjour ARaul,

Pour info, on n'utilise pas une procédure sous forme de FONCTION si celle-ci ne renvoie rien 🤔🫤
VB:
Function UploadPDFfile_INSCRIPTION()
  Dim pdfPath As String
  Dim fileDialog As Object
  Dim docsPDFPath As String
  Dim newPdfPath As String
  Dim fso As Object
                       
  docsPDFPath = ThisWorkbook.Path & "\docsPDF"
   
  Set fso = CreateObject("Scripting.FileSystemObject")
  If Not fso.FolderExists(docsPDFPath) Then
    fso.CreateFolder docsPDFPath
  End If
   
  Set fileDialog = Application.fileDialog(msoFileDialogFilePicker)
  fileDialog.Filters.Clear
  fileDialog.Filters.Add "PDF Files", "*.pdf", 1
   
  If fileDialog.Show = -1 Then
    pdfPath = fileDialog.SelectedItems(1)
       
    newPdfPath = docsPDFPath & "\" & fso.GetFileName(pdfPath)
       
    fso.CopyFile pdfPath, newPdfPath, True
       
    TextBox24.Value = newPdfPath
       
    WebBrowser1.Navigate newPdfPath
  End If
End Function

Et sinon, peut-être en désactivant le rafraichissement écran
Code:
Sub UploadPDFfile_INSCRIPTION()
  Dim pdfPath As String
  Dim fileDialog As Object
  Dim docsPDFPath As String
  Dim newPdfPath As String
  Dim fso As Object
  docsPDFPath = ThisWorkbook.Path & "\docsPDF"
  Set fso = CreateObject("Scripting.FileSystemObject")
  If Not fso.FolderExists(docsPDFPath) Then
    fso.CreateFolder docsPDFPath
  End If
  Set fileDialog = Application.fileDialog(msoFileDialogFilePicker)
  fileDialog.Filters.Clear
  fileDialog.Filters.Add "PDF Files", "*.pdf", 1
  If fileDialog.Show = -1 Then
    ' Désactiver l'écran
    Application.ScreenUpdating = False
    ' La suite
    pdfPath = fileDialog.SelectedItems(1)
    newPdfPath = docsPDFPath & "\" & fso.GetFileName(pdfPath)
    fso.CopyFile pdfPath, newPdfPath, True
    TextBox24.Value = newPdfPath
    WebBrowser1.Navigate newPdfPath
    ' Réactiver l'écran
    Application.ScreenUpdating = True
  End If
End Sub

A+
Merci pour votre apport.
Mais je n'ai pas eu satisfaction.

Le problème persiste.
 
Bonjour à tous .
Pour pouvoir tester correctement j'ai du modifier les sub ci-dessous dans Userform1 :
VB:
Function showPDFinAnotherWebBrowser_INSCRIPTION()
    Select Case True
        Case TextBox24 = "":    MsgBox "Aucun Document PDF chargé.", vbExclamation
        Case Dir(TextBox24) = "":  MsgBox "Document PDF non trouvé", vbCritical
        Case Else
            Me.Hide
                UserForm3.WebBrowser1.Navigate TextBox24
                UserForm3.Show
            Me.Show
    End Select
End Function

Function ExtractPDFLinktoWebBrowser()
    WebBrowser1.Navigate "about:blank"
    Select Case True
        Case TextBox24.Value = "":
        Case Dir(TextBox24) = "": MsgBox "Document PDF non trouvé", vbCritical
        Case Else:                WebBrowser1.Navigate TextBox24.Value
    End Select
End Function
Chez moi aucun clignotement.
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
1
Affichages
196
Réponses
2
Affichages
194
Réponses
11
Affichages
186
  • Question Question
Microsoft 365 affichage userform
Réponses
4
Affichages
530
Retour