Hello,
Just realised that my saveAs dialog [GetSaveFileNameW] only returns the FILENAME rather than the FULLPATH + Filename ?
on a quick debug.print it prints the following:Code:Public Function cDlgShowSave(ByVal InitialDir As String, _ ByVal DialogTitle As String, ByVal frmHwnd As Long, _ Optional Filter As String = "Text File(*.txt)|*.txt", _ Optional FileTitle As String = vbNullString, _ Optional ByRef rtnFilter As Long = 1) As String On Error GoTo errFound Dim OpenFile As OPENFILENAME Dim lReturn As Long Dim FileFilter As String Dim strFile As String If FileTitle = vbNullString Then strFile = String$(512, 0) Else FileTitle = Replace(FileTitle, "\", "_") FileTitle = Replace(FileTitle, "/", "_") FileTitle = Replace(FileTitle, ":", "_") FileTitle = Replace(FileTitle, "*", "_") FileTitle = Replace(FileTitle, "?", "_") FileTitle = Replace(FileTitle, Chr$(34), "_") FileTitle = Replace(FileTitle, "<", "_") FileTitle = Replace(FileTitle, ">", "_") FileTitle = Replace(FileTitle, "|", "_") strFile = String$(512, 0) strFile = FileTitle & String$(512 - Len(FileTitle), 0) End If OpenFile.lStructSize = Len(OpenFile) OpenFile.hWndOwner = frmHwnd OpenFile.hInstance = App.hInstance FileFilter = Replace$(Filter, "|", vbNullChar) If AscW(Right$(FileFilter, 1)) <> 0& Then FileFilter = FileFilter & vbNullChar OpenFile.lpstrFilter = StrPtr(FileFilter) OpenFile.nFilterIndex = rtnFilter OpenFile.lpstrFile = StrPtr(strFile) OpenFile.nMaxFile = Len(strFile) OpenFile.lpstrFileTitle = StrPtr(strFile) OpenFile.nMaxFileTitle = Len(strFile) OpenFile.lpstrInitialDir = StrPtr(InitialDir) OpenFile.lpstrTitle = StrPtr(DialogTitle) OpenFile.flags = 0 lReturn = GetSaveFileName(OpenFile) If lReturn = 0 Then 'Cancel Button Pressed Else cDlgShowSave = Left$(strFile, InStr(strFile, vbNullChar) - 1) debug.print strFile rtnFilter = OpenFile.nFilterIndex End If Exit Function errFound: MsgBox Err.Description, vbCritical, "File Save" cDlgShowSave = "" End Function
NewFile.txt Admin\Desktop\NewFile.txt
So it's stripping out the NewFile.txt.
Even if i did reverse this and strip the right side out, its still missing the Drive letter?
How can i find out the Drive letter to complete the puzzle?






Reply With Quote
