Kaydet Diyaloğu

#If VBA7 And Win64 Then
    Private Type OpenFileName
        lStructSize       As LongLong
        hwndOwner         As LongLong
        hInstance         As LongLong
        lpstrFilter       As String
        lpstrCustomFilter As String
        nMaxCustFilter    As LongLong
        nFilterIndex      As LongLong
        lpstrFile         As String
        nMaxFile          As LongLong
        lpstrFileTitle    As String
        nMaxFileTitle     As LongLong
        lpstrInitialDir   As String
        lpstrTitle        As String
        flags             As LongLong
        nFileOffset       As Integer
        nFileExtension    As Integer
        lpstrDefExt       As String
        lCustData         As LongLong
        lpfnHook          As LongLong
        lpTemplateName    As String
    End Type
#Else
    Private Type OpenFileName
        lStructSize       As Long
        hwndOwner         As Long
        hInstance         As Long
        lpstrFilter       As String
        lpstrCustomFilter As String
        nMaxCustFilter    As Long
        nFilterIndex      As Long
        lpstrFile         As String
        nMaxFile          As Long
        lpstrFileTitle    As String
        nMaxFileTitle     As Long
        lpstrInitialDir   As String
        lpstrTitle        As String
        flags             As Long
        nFileOffset       As Integer
        nFileExtension    As Integer
        lpstrDefExt       As String
        lCustData         As Long
        lpfnHook          As Long
        lpTemplateName    As String
    End Type
#End If

#If VBA7 And Win64 Then
    Private Declare PtrSafe Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OpenFileName) As LongLong
#Else
    Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OpenFileName) As Long
#End If
 
Public Function SaveFileName() As String
    Dim OFName As OpenFileName
#If VBA7 And Win64 Then
    OFName.lStructSize = CLngLng(Len(OFName))
#Else
    OFName.lStructSize = Len(OFName)
#End If
    'OFName.hwndOwner = Form1.hWnd
    'OFName.hInstance = App.hInstance
    OFName.lpstrFilter = "Excel Dosyaları (*.xlsm;*.xlsb)" + Chr(0) + "*.xlsm;*.xlsb" + Chr(0) ' NullChar ile bitecek
    OFName.lpstrFile = Space(254)
    OFName.nMaxFile = 255
    OFName.lpstrFileTitle = Space(254)
    OFName.nMaxFileTitle = 255
    OFName.lpstrInitialDir = "C:"
    OFName.lpstrTitle = "Kayıt için dosya seçin"
    OFName.flags = 0

    If GetSaveFileName(OFName) Then
        SaveFileName = Trim(Replace(OFName.lpstrFile, Chr(0), ""))
    End If
End Function

Yazar: mmustafaaslan

2004 yilindan itibaren ozel bir sirketin finans departmaninda calismaktadir. Kendini excel, visual basic kullaniminda gelistirmis olan yazarimiz; Meslegi geregi SAP konusunda ileri derecede bilgilidir.

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir


3 + 6 =