Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Change File Extension


Hi ,

Can anyone tell me how to add a particular extension to a file which has no previous extension ... like adding .txt extension etc..

Any input will be appreciated...

Thanks in advance..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
.txt File Extension Change
I have a program that in the sub_load it reads some info from
a '.txt' file and places the info into an array. Can I change the
extension to '.sdt' and the program still see it as a text file?

Change File Extension
Hello all,

I have an acess database xxx.mdb. I don't want to leave it as it is because the users will open it add some stuff that will make my app crash.

So the question is, how could I change the extension from xxx.mdb to a new extension? Just to make it less obvious that it's a database file.


I'd appreciate any comment.

Change A File's Extension
I'd like to change a file (test.txt) to (test.log) for example. How can I do this using VB. Do I have to create test.log, open test.txt, copy the contents, and kill test.txt? Or is there a simpler way? (Yes I realize you can just right-click the file and "rename" but I need to do this via code)

Thanks in advance!

Change The Extension Of File Through VB
Dear

I want to change the extension of a file through VB.
I have a file as"V3621001.TXT.decrypt" and want to change "V3621001.TXT" this formate.Please help me to do this thing

Change File Extension By Code
Please help me....
I have some Word files that i Would to open wiht a rich text box.
I was thinking i can change them in txt by code.

I was thinking i can read the word file and then create another one with txt extension pasting the text of the word file.

Is it possible???

I'm using Ole to open the files in VB, but i did not find an property of ole that reurns me the text of the file.



Otherwise, is possible, using ole, add the scroll bars without running the application?

Change File Extension Of All The Files In A Folder
How do I change the file extension of all the fies contained in a folder please if thats not too much too ask

Thanks in advance

Knowledge is the rule

Excel Extension Change
I have a program that begins with loading a custom Excel spreadsheet and then forces the user to save it via the SaveAs common dialog box. I am attempting to change the file extension from .xla to a custom extension. How do you code the extension change and the filter for the dialog box.

I tried the dialog box filter method that I have used in VB6 and it didn't seem to work. I am using Office 2000.

Change Filename Extension
How can I change the extension of every file in a given directory from .txt to .htm? (I have VB6, not VB.Net). Thanks.

bodhi

Change The Extension Of Files
Hi,
I tried to write a macro program for user who want to change the extension of files in their multiple directories.
So far, I finished some of program. However, it wasn't working right. Anyone can give me help, I will very appreciated.

Sub exchange_files()
'
' exchange_files Macro
'
Set fs = CreateObject("Scripting.FileSystemObject")

Set file1 = fs.OpenTextFile("C: empallen.rtf", 1)

Set txtfile = fs.CreateTextFile("C: empjennifer.txt", True)

fs.CopyFile "C: empallen.rtf", "C: empjennifer.txt"

file1.Close
txtfile.Close

End Sub

The program shall find all .rtf in all directories, then convert all the files with the extension of .rtf into the extension of .txt.

That is all the program need to do.

Thank you for any help.

CommonDialog - Name And Extension Change Prevention?
I'm using CommonDialog to get "Save File" window.
How can I preven users from changing file name and extension?

FileSystem.Rename (change Extension)
Hey ppl, I have a .NET question;
When I try to rename a file with FileSystem.Rename, it gives an error when I try to rename the extension of the file, like:

VB Code:
FileSystem.Rename("c:file.txt", "c:file.log")

It gives me an error...

is there an other (easy) way to change the extension for a file?

Thanks

I Am Updating My Class To Open Mdb's With A Phony Extension, But The Icon Doesn't Change
I have been updating/modifying the class module I use for connecting to mdb databases so I can post it in the CodeBank forum. I know a lot of programmer's use a phony extension as an extra form of security. I have that part working, so if the mdb is renamed as a txt file, the class will still open it. The problem I have is that when viewed in Explorer, the file still shows the Access icon. I don't know how to change that part. For the camoflauge to work, an mdb file with a txt extenstion should show the NotePad icon from Explorer. What else do I need to change? Thanks much


God Bless America

Remove File Extension From A String Of A File Path
I need to take a file extension off a string:


VB Code:
cPDB = flbMain.List(nPDB)


returns:

"C:my documents est.pdb"

and I want to remove the ".pdb"

How?

Thanks for any help

- Jake

Associate File Extension With A Program And Opening A File
I have made a program that reads and writes to db's which has the extension ".mdb". Now i tried the code if i changed the extension to ".kom" instead and it still works fine and dandy but they can't open it in msacess unless they say open with ms access. Now i was wondering if there is a way in code to say that ".kom" files have "c:myico.ico" as an icon and open with "c:myprog.exe"? I know how to do it manually but have no idea how to do it in code.

Also this is how you can open a file with its default extension.

Code:
Call ShellExecute(Me.hwnd, vbNullString, "C:happy.txt", vbNullString, vbNullString, 0&)

and here is another way

Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_MAXIMIZE = 3
Private Const SW_MINIMIZE = 6
Private Const SW_NORMAL = 1


Call ShellExecute(Me.hwnd, vbNullString, "C:happy.txt", vbNullString, vbNullString, SW_NORMAL)



Now is there a way to specifiy what program you want the file to be opened it? Like for example instead of having
"C:mytext.txt" open in notepad maybe i want it to open up in wordpad or ms word. Is there a way to do this?

Thanks!!

File Extension
Private Sub Command3_Click()
strName = InputBox("Please Enter A Name For Your Saved Game", "Save Your Game")
Open strName For Output As #1
Write #1, (Form1.txtPromotionShortName.Text), (Form1.txtPromotionLongName.Text), (Form1.txtPromotionCountry.Text), (Form1.txtPromotionLevel.Text), (Form1.lblPromotionPopularity.Caption), (Form1.txtPromLower1.Text), (Form1.txtPromLower2.Text), (Form1.txtPromMain1.Text), (Form1.txtPromMain2.Text), (Form1.txtPromMiddle1.Text), (Form1.txtPromMiddle2.Text), (Form1.txtPromTag.Text), (FrmMain.Label2.Caption), (FrmMain.txtMoney.Text), (FrmMain.txt0Day.Text), (FrmMain.txtDay.Text)
Close #1
txtFileName.Text = strName
FrameSave.Visible = False
End Sub

that above is my text which saves a file. can someone add a line of code in so my files that saves, saves in a .PM file. THANKS

Get File Extension
Hi,
How can i get the extension of a file opened with commondialog control?

File Extension
Hi, I'm using commanddialog to get the chosen file extension, but i wasn't able to make it, can someone help me with this?

thanks

File Extension
Hello i am trying to create a program that can set any valid pictures from anywhere on windows as Msn Messenger display pictures but first i need to know how to show my program in the "Open With" menu of Windows Explorer and i need a code to validate check file extension (incase users is trying to open .exe with the program.)

I already know how to get the filename that lauch the program but i need to know how to get the file extension...

..And how to add my program in the "Open With" Context Menu

any help will be really appreciated. Thanks

File Extension
hey there!!!
here iz a gigantik problem....
i want a own file extension for my file. like a .lrc .lrd
how do i make it?
i have applied the extension to my app but the problem is
i want it to have an icon specified by the app?

File Extension
How can I find the extension of a file. I think that I can make VB read the part after the last "." in the filename-using left()-; but how can I find that last "."?

File Extension
If I have ".xxx" how do I search the Windows to find out what the extension is? ex. .txt -> Text Document

File Extension
Hello to all,

I mess with a program called FilZip 2.01 and it rename all my zip files extension to FileZip File.

Example

C:MyFiles
A234.FileZip File
LvSmp.FileZip File

Is there anyway I can rename it back to its original state using vb code. I need to pass the name of the directory and change all the files extension to .Zip.

C:MyFiles
A234.zip
LvSmp.zip

thanks a bunch

File Extension
what file extension does visual basic use for project files

File Extension
I am using a Microsoft Common Dialog Object to browse the file .. But i want the user to only have access to text files .. how do i do this ..


Thanx

MY File Extension!
Is it possible to create my own file extension.

Such as: "SomeFile.zzz

If so, could someone give me some direction on how to get started.

Thanks,

JO

Own File Extension - HELP!!
Does anyone know the code to make your own file extesion such as *.cjp ?? It's urgent, please help!!

File Extension PRE
Does anyone know how can I read file which has extension PRE.

Thanks
Jamppa

My Own File Extension
I was wondering if anyone could tell me how to make my own file extension. i want it to store encrypted text, if that helps out any. I would appriciate any pointers or perhaps a site or 2 that could help me out.


Thanks alot in advance and happy holidays, eh

Kyle

File Extension
How can i get the file extension of a file from a filename?



Edited by - Phoenix00 on 9/11/2004 5:46:51 AM

App File Extension
hello,

does anyone know how to find out the File extension of a program that is running?

For Example:
I what the program to have the File extension of .dll and I don't want people to be able to change it to .exe and run it.

so does anyone know how to check what File extension the program is using when it first opens up?

thanks.

File Extension
any kind person out there got a code that would add a file extension to windows.

ie the same way as if you opened a folder hit tools , file types and the manualy added the extension.

can this be done in VB

Remove File Extension From File List Box
in my program i want File1(filelistbox) to display a list of text files(010101.txt,010102.txt,etc).when i select a file in the list, its contents appear in a rich text box. is there anyway to hide the extensions(.txt) of the files in the filelistbox? by using,

Code:
Text1.Text = Left(File1.List(File1.ListIndex), Len(File1.List(File1.ListIndex)) - 4)
i can make the name of the selected item(w/o the ".txt") appear in a textbox. could i somehow use this approach in creating a filelistbox that only displays the names of files, and not their extension? thanks in advance. jrob. www.jrob.tk

How Do I Display File Icons From File Extension?
Ok, I got a file explorer. But How can I display the icons of the files? At the moment It only shows a standard icon with the filename. I would only need to know how to get the icon of a file
that I have the extension from. For Example a *.doc file I would need to display the Word Icon. Any ideas?

File Extension Registration
Hi

Another installation question. Sorry. I use InstallSheild 5.5 to package up my application. It is an SDI ActiveX EXE that creates a 'document' with file type ".pgs". I've managed to create the script in IS5.5 to register this file type with my EXE so that double-clicking on a PGS file opens up the file with my app. Great, I thought. But, one thing I have noticed is that any ".pgs" files appear in Windows Explorer without an icon that associates them with my app. That is, they have a Windows Icon associated with them. What am I doing wrong?

Cheers

File Extension Register
I have an Mp3 player and i would like to know how to register an extension (*.dan) and have a default icon from vb.
All help is appreciated.
Dan_

Excel File Name And Extension
This seems like such an easy thing, but I cannot seem to find the answer.
I want to get an Excel file name and extension, but not the path. So I am using the the following code to get into the test folder, which is where the file is stored:

Code:
ChDir "C:WINDOWSDESKTOP est"
Now, I want to put the filename into a variable. For example, if I have a file named Books.xls in the C:WINDOWSDESKTOP est directory, the variable should only return Books.xls

Any help would be great
Thanks

How Do I Remove The Extension From The File Name.
I have hundreds of text files that have been created through Excel that need to have the .TXT extension removed.
I have the files in one folder and the files names listed in a column in Excel. I have a code that opens in a New Workbook a file that is listed, does several Search/Replaces, saves the file as text in a different folder, closes the Workbook and loops to the end of the file list.
All of the files have the .TXT extension which needs to be removed.
I've tried to search the Forum for the answer but came up with no solution. The searches bring up lots of threads that have nothing to do with what I searched for.
I have no training in VB, I just alter already existing code.

Thanks for your help.

File Extension In FileListBox
Is there a way to make a FileListBox only show the file name and not the extension too?

Search For Certain File Extension
How would I create a program that would scan the user's computer for files of a certain file type?

Thanks!

Ignoring A File Extension?
Hi, after dropping a file extension, I would like to be able to have my program ignore a file that has already had it dropped. I need this because when I double click on the text field, the second click thinks I need to drop the extension again, but there isnt one, so it gives an error. Suggestions? Thanks

Code:
Private Sub txtsave_Click() 'had to declare it as a string as well

If MyFile1 = "" Then
MyFile1 = "untitled"
Else
MyFile1 = Mid$(MyFile1, 1, InStrRev(MyFile1, ".") - 1)
End If
'If MyFile1 already has the .rtf extension removed, then ignore it.

CommonDialog1.Filter = "Rich Text (*.rtf)|*.rtf"
CommonDialog1.FileName = MyFile1
RichPad.txtsave.Text = MyFile1 'displays the actual text

Checking File Extension
A form in use, allows the user to enter a Save filename in a textbox, or to populate the textbox using a Save CommonDialog.

The file to be saved, can be in a variety of formats, but allowing for dumb users, I need to be able to check at the final stage before output that the extension to the filename given, is valid for the format thet have selected.

Eg, if they selected Excel, then then extension must be xls, text = txt etc

Any ideas on how I can perform this task, and raise an error if the Type/Extension relationship is incorrect.

Thanks

File Extension Question
In my project I have 8 MSFlexgrids. All are populated from text files within the formload sub. All data is created by user input. I want the user to be able, at the end of each month to save what they have entered to a new text file, then start a new empty form for the next months data. I was wondering, can I make up my own extension and populate the flexgrids using the new extension? That way if the user wants to delete the monthly text files they created from the Menu>Save they don't accidently delete one of the program files I use to hold the data until the end of each month. If so will Windows Note Pad let you create your own extensions?

What Kind Is The File With Extension .tlb ?
Hi VB Friends,
As Title, i only know about the creation of ActiveX DLL,EXE,Control.
When i reference some class libraries in VB, i can include libraries with extension .tlb.
How to create such files with VB?

Thank you

New File Type (with Its Own Extension)
Does anyone have any tips on creating a good file format for a title mapper?

Specifically, i am working on a title mapper that just uses individual 16x16 pictureboxes that hold one bitmap each. The grid is made of numbers representing wich picturebox it got the picture from. What i need for version 4.0.0 (currently in progress) of this little tinker-toy is to be able to save 1 whole bitmap of all the titles the user custom selected from other bitmaps. that way, the application becomes very flexible and is able to load the bitmap with the corresponding numbers for each title on the grid (so that each grid title can get the appropriate title from the large bitmap.)

I can't post the actuall project (version 3.0.0) to show right now because im not at home right now. I will post it later

Help Required .RES Extension File
Hi


I want to know about the .RES extsion file, Located in the Project Explorer Under the Realated Document Head.
Please any one can tell me about this that why we add this type of file in any VB Project. What is the Purpose of This File

Thank a Lot in Advance.

Own Music File Extension
Is there anyway someone could lead me on the right path. I want to make a program that records sound without using a control or component and then saves it as my own file extension. Is there anyway of going about that?

How To Get The File Name Without Extension From The Given String
I wanted to get last few characters from the given text
i.e. “C:DocumentWorld HealthSummeryAccessNet.txt”

I wanted to get the only the file name i.e. AccessNet (excluding file extension (.txt))

I have tried out using InStr and Mid function, but not get the positive result and I have given up and decided to get it from here

Please help me it’s an urgent


Note: the file name is always changing based on the selection, I am not using common dialog, so plz don’t say use cdl.fileName method 

Remove File Extension
I have a browse button and a textbox. My browse button browses for a file, then places the file title in the textbox. I want the extension to be removed. All I want it to say in the text box is the title without extension (for example from Hello.bsp to Hello). BSP is the only extension that will be in the box, if that helps. How can I achieve removing the extension?

How To Find A File's Extension
is there a method on how to find a file's extension (.exe, .dll, etc)? if there is, how do you use it? thanx alot

Copyright © 2005-08 www.BigResource.com, All rights reserved