[VBA PPT2003] Fonction FileDialog(msoFileDialogSaveAs) choix du filter

Fonction FileDialog(msoFileDialogSaveAs) choix du filter [VBA PPT2003] - VB/VBA/VBS - Programmation

Marsh Posté le 10-01-2006 à 10:32:01    

bonjour,
 
je n'arrive pas à mettre une option filter donc jpg et le seul moyen que j'ai trouvé c est d exporter en jpg
 
voici mon code :
 

Code :
  1. Sub Function_SaveAsJpg()
  2. With Application.FileDialog(msoFileDialogSaveAs)
  3.          .AllowMultiSelect = False         'Un seul Fichier possible
  4.          .InitialFileName = "C:\Mes donnees\"          'Répertoire d'ouverture de la fenetre
  5.          .Title = "Choix de l'image"
  6.         If .Show = -1 Then
  7.             TheFile = .SelectedItems(1)
  8.             Application.ActivePresentation.Slides(1).Export TheFile & ".jpg", "JPG"
  9.             Call Function_RemiseA0
  10.             Call supprImage
  11.             Unload UserForm4
  12.             UserForm3.Show
  13.         Else: TheFile = 0
  14.                 Exit Sub
  15.         End If
  16. End With
  17. End Sub

Reply

Marsh Posté le 10-01-2006 à 10:32:01   

Reply

Marsh Posté le 12-01-2006 à 15:26:17    

Hello,
 

Code :
  1. Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pSavefilename As SAVEFILENAME) As Long
  2. Private Type SAVEFILENAME
  3.     lStructSize As Long
  4.     hwndOwner As Long
  5.     hInstance As Long
  6.     lpstrFilter As String
  7.     lpstrCustomFilter As String
  8.     nMaxCustFilter As Long
  9.     nFilterIndex As Long
  10.     lpstrFile As String
  11.     nMaxFile As Long
  12.     lpstrFileTitle As String
  13.     nMaxFileTitle As Long
  14.     lpstrInitialDir As String
  15.     lpstrTitle As String
  16.     flags As Long
  17.     nFileOffset As Integer
  18.     nFileExtension As Integer
  19.     lpstrDefExt As String
  20.     lCustData As Long
  21.     lpfnHook As Long
  22.     lpTemplateName As String
  23. End Type
  24. Private Sub Save_Click()
  25. Dim OFName As SAVEFILENAME
  26.     OFName.lStructSize = Len(OFName)
  27.     'Select a filter
  28.     OFName.lpstrFilter = "Image Files (*.jpg)" + Chr$(0) + "*.jpg;*.jpeg"
  29.     'create a buffer for the file
  30.     OFName.lpstrFile = Space$(254)
  31.     'set the maximum length of a returned file
  32.     OFName.nMaxFile = 255
  33.     'Create a buffer for the file title
  34.     OFName.lpstrFileTitle = Space$(254)
  35.     'Set the maximum length of a returned file title
  36.     OFName.nMaxFileTitle = 255
  37.     'Set the initial directory
  38.     OFName.lpstrInitialDir = "C:\"
  39.     'Set the title
  40.     OFName.lpstrTitle = "Save Image"
  41.     'No flags
  42.     OFName.flags = 0
  43.     'Show the 'Open File'-dialog
  44.     If GetSaveFileName(OFName) Then
  45.         MsgBox "File to Save: " + Trim$(OFName.lpstrFile)
  46.     Else
  47.         MsgBox "Cancel was pressed"
  48.     End If
  49. End Sub


Message édité par Vasek le 12-01-2006 à 15:35:46
Reply

Marsh Posté le 12-01-2006 à 15:41:27    

ok je vais regarder

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed