?
Solved

File Save As Dialog Box

Posted on 2003-03-13
5
Medium Priority
?
238 Views
Last Modified: 2006-11-17
I have a quetion concerning the "Save As" function.
I have a label with caption of the the filename of an existing file on a CD.
I am opening a box similar to the "Open" box.
My question is this how do I "prefile" the filename listed in lable.caption to the "Filename" box?
And then when I run the Filcopy commadn..how do I make that work.
Here is my code...thanks

Private Sub mnuFileSaveAs_Click()
Dim sFile As String
    With dlgCommonDialog
        .DialogTitle = "Save"
        .CancelError = False
        .Filter = "All Files (*.*)|*.*"
        .ShowOpen
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
    End With
    FileCopy Label2.Caption, ""
End Sub
0
Comment
Question by:Akula
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
jayeshshah earned 240 total points
ID: 8129860
Add the below lines of code in your function.

Private Sub mnuFileSaveAs_Click()
Dim sFile As String
   With dlgCommonDialog
       .DialogTitle = "Save"
'*******************************************************
'         add the below lines
      .filename = label2.caption
      .Flags = cdlOFNFileMustExist
'*******************************************************
       .CancelError = False
       .Filter = "All Files (*.*)|*.*"
       .ShowOpen
       If Len(.FileName) = 0 Then
           Exit Sub
       End If
       sFile = .FileName
   End With
   FileCopy Label2.Caption, ""
End Sub
0
 
LVL 1

Author Comment

by:Akula
ID: 8129927
That did the trick, now for the second part of question.
how do I do the FileCopy part?

FileCopy Label2.caption, ????????

Thanks
0
 
LVL 1

Author Comment

by:Akula
ID: 8130343
That did the trick, now for the second part of question.
how do I do the FileCopy part?

FileCopy Label2.caption, ????????

Thanks
0
 

Expert Comment

by:RobMe
ID: 8131906
FileCopy is used as:

FileCopy "c:\file1.txt", "c:\file2.txt"

This would in your case be:

FileCopy Label2.Caption, dlgCommonDialog.FileName


The CommonDialog will save the full path and specified filename as its FileName when you click "Save"

0
 
LVL 1

Author Comment

by:Akula
ID: 8131925
I figured out the last part just before you posted...thanks and here's your points.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question