?
Solved

File Save As Dialog Box

Posted on 2003-03-13
5
Medium Priority
?
242 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
  • 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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

599 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