Solved

Common Dialog Save As

Posted on 2004-09-15
8
1,178 Views
Last Modified: 2013-12-25
I know this has to be simple but I just can't find the answer.
Coding in Visual Basic 6 using the Common Dialog Box Control

My user opens a file say for example "me.wav". Then user user does a File SAVE AS and picks a different filter than than the orginal file name. example:r "wma".  The Users orginal file name says me.wav, but I want the file name extention to be what  ever filter was picked.  Example picked "wma"  the file name would me me.wma.  Picked "mp3" the file name would me.mp3.  
0
Comment
Question by:MKadric
[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
8 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 12064425
you can see demo here
source : http://www.freevbcode.com/ShowCode.asp?ID=2773

you need to change the filter lines in the demo to

    Filter = "Alwee Files (*.alw)|*.alw|" 'This is the normal way of opening a file with your own ext.
    Filter = Filter + "JPEG Files (*.jpg)|*.jpg|" 'Shows JPG Files(This is how you normally open a file)
    Filter = Filter + "All Formats (*.*)|*.*" 'Show both formats at once

then it works to open jpg and save as alw

HTHAB
0
 

Author Comment

by:MKadric
ID: 12064929
Thank you, but I guess I did not state question clearly. I can save the file to any filter I have coded.... I WANT THE FILE NAME TO CHANGE WHEN THE USER SELECTS A DIFFERENT FILTER... Like Microsoft word... You open a Doc file example.... Me.doc and do a file save as and the file name is in the Box File name with the extention of the say text.... me.txt.... It does this automatically when the user changes the filter.   The file name no longer says me.doc.... it says me.txt.... depending what filter the user picked.... Same with excel... user opens file me.xls does a file save and picks txt as the filter and the file name is now me.txt...... not me.xls... user did not have to change... the file name extenion changed depending which filter was picked.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 12064968
aha .... that's clear :) have to try
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MKadric
ID: 12065024
Thanks
0
 
LVL 3

Expert Comment

by:redfordb
ID: 12072712
Are you talking about the file name in the common dialogue, or only once the user clicks the save button ?
0
 

Author Comment

by:MKadric
ID: 12073124
1. Select File open... There is now a file that can be saved in another format.... Original File name is    me.avi

2. Select File Save As. The file name is the File name box is     me.avi.

3. User clicks the "Save as type" (the filter) and selects the “Save as type:”     Wav Files (*.wav).

4. Immediately I want the file name to remain the same but the extension to change to wav.     So the File name would now be me.wav

This is the way Word, Excel and all Save AS works.
I just can’t get the extension to change in the File name box when I select a new Save As type.  A person would think that this would be pretty important due to the fact if the user has to change the file name extension to the filter they selected, 9 times out of 10 that won't happen and they will over write the original file.  I have looked on Microsoft for the answer; I have down loaded at least 20 examples of the Common dialog vb projects.  None of them including Microsoft helped with the answer.

  I sure would appreciate the answer if any body knows.
0
 
LVL 5

Accepted Solution

by:
JMoon5FTM earned 250 total points
ID: 12096552
Microsoft Office uses its own, special file dialog - so don't look for the answer there.

There is, to the best of my knowledge, no easy way of doing what you want.  To do this, you would need to throw away the Common Dialog control, call the Windows API directly, use a hook function, and use a few hundred lines of code.

That or lower your standards.  Many commercial applications don't act like Word and Excel.
0
 

Expert Comment

by:neil17317
ID: 22458654
i love this site.... i learned a lot....!!!!!!!!!!!!!!!!!!thanks experts made  beginners an easier life
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

726 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