Solved

Common Dialog Save As

Posted on 2004-09-15
8
1,168 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
 

Author Comment

by:MKadric
ID: 12065024
Thanks
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now