Solved

Common Dialog Save As

Posted on 2004-09-15
8
1,179 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

724 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