> I want to save file Punk_History.def to a directory chosen by the
> user. When I execute the code below, the dialog box says the file has
> been saved. Problem is that the file does not exist in the directory
> I chose to save it in. Why doesn't it work?
> Dim Pathy as string
> Pathy = "C:\Program Files\Games\"
> With CommonDialog
> .DialogTitle = "Archive File - Punk_History.def"
> .CancelError = True
> .Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt +
> cdlOFNPathMustExist + cdlOFNNoChangeDir
> .Filter = "All Files(*.def)|*.def"
> .FilterIndex = 1 '1 = Save and 2 = Open
> .DefaultExt = ".abd"
> .Filename = "Punk_History.def"
> .InitDir = Pathy
> MsgBox "You saved the files as " & .Filename
> End With
The Common Dialog box allows you to pick, or type in a file name to save the
file as, it doesn't save anything in and of itself. You'd need to redo your
code above as ...
Everything within your With statement except the MsgBox Statement
Insert code here to actually create the file and write the information into
it then close the file
Your MsgBox reporting a successful save, or a failed one if it didn't work.
Hope this is some help.