|
-
Apr 19th, 2005, 01:23 PM
#5
Thread Starter
Member
Re: Help: Should I use Common Dialog or ??
Isn't it interesting the way education works?
After writing my post, and reading your reply, I was composing a reply when a "light went on" and I solved my problem.
All except one ... I used the following as a template:
Code:
Private Sub cmdSave_Click()
Dim strBuffer As String
Dim intDemoFileNbr As Integer
Dim strFileToSave As String
On Error GoTo cmdSave_Click_Exit
With dlgDemo
.CancelError = True
.InitDir = mstrLastDir
.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist
.FileName = ""
.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"
.ShowSave
strFileToSave = .FileName
End With
On Error GoTo cmdSave_Click_Error
intDemoFileNbr = FreeFile
Open strFileToSave For Binary Access Write As #intDemoFileNbr
strBuffer = txtTestFile.Text
Put #intDemoFileNbr, , strBuffer
Close #intDemoFileNbr
mstrLastDir = Left$(strFileToSave, InStrRev(strFileToSave, "\") - 1)
Exit Sub
cmdSave_Click_Error:
MsgBox "The following error has occurred:" & vbNewLine _
& "Err # " & Err.Number & " - " & Err.Description, _
vbCritical, _
"Save Error"
cmdSave_Click_Exit:
End Sub
Source: http://www.thevbprogrammer.com/index...ter=10&Topic=3
from a link I found while doing further snooping around on good ol' VBForums!
Again, this is a template and I have modified it for my purposes. It seems to work quite well, all except for the error routine. When I click on "CANCEL" when the CommonDialog window is open, I keep blowing up on "Runtime Error 32755" user selected Cancel.
I'm trying to get around this at the present time and I think I have a solution to that also. If not I'll whine some more 
Thanks for replying, I appreciate it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|