could someone help me with this API call for save as
I am not sure what to put in the fileSave stuff here. I tried to use print command but it acts like it saves it just doesn't save anything to my hard drive. I don't know anything about API calls.Code: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 Private Declare Function _ GetSaveFileName Lib "comdlg32.dll" _ _ Alias "GetSaveFileNameA" (pOpenfilename As _ OPENFILENAME) As Long _ Private Sub Command1_Click() Dim ofn As OPENFILENAME _ ofn.lStructSize = Len(ofn) ofn.hwndOwner = Form1.hWnd ofn.hInstance = App.hInstance ofn.lpstrFilter = "Text Files (*.txt)" + Chr$(0) + _ "*.txt" + Chr$(0) + "Rich Text Files (*.rtf)" + Chr$(0) _ + "*.rtf" + Chr$(0) ofn.lpstrFile = Space$(254) ofn.nMaxFile = 255 ofn.lpstrFileTitle = Space$(254) ofn.nMaxFileTitle = 255 ofn.lpstrInitialDir = CurDir ofn.lpstrTitle = "Dialog Title" ofn.Flags = 0 Dim A A = GetSaveFileName(ofn) If (A) Then MsgBox "File to Save: " + Trim$(ofn.lpstrFile) 'FileSave Stuff Here Else MsgBox "Cancel was pressed" End If End Sub 'Code improved by vBulletin Tool (Save as...)
Scoutt




Reply With Quote