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
Solved

Common Dialog Save As

Posted on 2004-09-15
8
1,176 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
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

840 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