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




Open Files


Is it possible to open other files than executeable files in Visual Basic? Even if it is f.eks a txt-file?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Open Multiple Files In Open Command Dialog
Hi,

Can anyone help me how to selecting/opening multiple .xls file uisng VBA then store in an array/variable each file name on by one? Im planning to create a VBA that will verify each file name that will be open.

Let say I have 10 files want to open, if the file name is not correct on my condition then it will not be open. If the condition will satisfied, then it will open the file.

Thanks!

Saving Files Already Open Files In Excel And Word
I need to program the condition where as a user is attempting to save an Excel or Word file that is already open. I'm using common dialog component and don't know how I can trap this error to inform them that the same named file is already open.

Open Files, Close Files
In the cmdProcess Procedure I have the Close_Files so I can force the Generate_Size_Report to be written to the txt.file. But when i put the Open_files in the Procedure it clears the txt.file so How can I make the files be written to the txt.file while the program is still running. And i need to keep the file as Output.



Private Sub cmdProcess_Click()
Generate_Size_Report
Close_Files 'I think The Problem is Right Here
Open_Files 'Or right here
End Sub

Private Sub Generate_Size_Report()
Print #2, "Extra Large: ", ELarge_Accum
Print #2, "Large: ", Large_Accum
Print #2, "Medium: ", Medium_Accum
Print #2, "Small: ", Small_Accum
End Sub

Private Sub Close_Files()
Close #1
Close #2
End Sub

Private Sub Open_Files()
Open "a:jimspizza.txt" For Append As #1
Open "a:jimsSizeReport.txt" For Output As #2
End Sub

HELP! Open Files, Find Files...
How to open an entire file without having quotes at the start and end?

How to make my app. locate a file?

How to tell the app. where it was launched from?

HOw Do I Open Files?
Ok. I want to open files using one of the load file dialog box things. How do I set this up? I want the user to specify what file they want, and then the file opens. I need the same for saving, but it's about the same, right?

Open LDT Files
I'm a rookie in VB.
I'm making a catalogue for my company and I'm using VB6.
I need to open a file with LDT extension.
The LDT works with Dialux which opens in windows if we use the right click of the mouse and choose "open with dialux project".


I don't need to see the file, just to open it in Dialux.
Somebody told me drag n drop could do the business but I can't find in internet command or help.

Can you help me using a command within VB6?

Open Files ?
this is a bit hard 2 explain, lol.
you know when you go into paint (or any other program) and press file/open it comes up with that box that lets you select a file and what file type?
is there a way in visualbasic to make that or use that same one. part of a program i am writing requires the user to select an image from a directory, once they open the file how to i store/manipulate it /

How Do You Open Exe Files
Hi, I created a program years ago in visual basics and I need to edit the program and it is now an exe file is there anyway I can open it up?

Open Files And Get/Put
Heres the problem, i want to make a program that will copy a file. Why dosen't the following code work?


Code:
Private Sub Command1_Click()
Dim a As String
Open "C:log.log" For Binary As #1
Open "C:log2.log" For Binary As #2
For x = 1 To LOF(1)
Get #1, x, a
Put #2, x, a
Next x
End Sub
I think that I am misunderstanginf the use of the get/put function, any help would be appreciated.

Open Files
I want to allow the user to open a picture file and put it in a picturebox. Basicly, I have no idea how to do this. I have a textbox for opening the file and a browse button that is supposed to help you look for the file and it will type in the address for you in the textbox. Then when you click the display button the picture will apear in the picturebox; and you can do this again and again.
Here is an example of some code i cutpasted form my VB help:

Code:
Private Sub mnuFileOpen_Click ()
' CancelError is True.
On Error GoTo ErrHandler
' Set filters.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text _
Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' Specify default filter.
CommonDialog1.FilterIndex = 2

' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
OpenFile (CommonDialog1.FileName)
Exit Sub

ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
Because of something said in my VB help, I think this would have worked if I had commdlg.dll loaded, but for some reason it would not go into the references or components box.

Also I dont really have a clear idea wht to do after I get the Open File box working so help on that would be great too.

P.S. I would really like to understand this, not just cut/paste it, Thanks!

How To Open Exe Files From Within VB?
Is there such a way to do this?
I have these programs that control signal generation machines. So can vb execute these programs? I know those programs don't have OLE connections.

What api functions?

Open Files!?
Hello! I am newbie at Visual Basic!

I wonder how to OpenFiles when i press a button.

Is the code OpenFile or Shell!?
Please write me an example!

(i want open a exe file from C:Program FilesViTAL.exe when i press a button)

Open VB 6 Files In VB 5
Hey, I wondered if there was an easy way to open VB 6 files in VB 5. I use 6 at home which is fine but when i want to open these files at school with VB 5 it is very awkward. The only way i can do it is by manually opening the .vbp file with notepad and removing a couple of lines (Retained=0, DebugStartupOption=0, CodeViewDebugInfo=0). I hope there is a much easier way to do this. It is extremely annoying to do it constantly as i move between the two applications a lot. Thanks in advance!

Open Associated Files?
How would i go about making my program, associated with all .b files, and whenever i open a .b file it will open my program and load the contents of the .b file into a text box?

How Can I Open Wmv Files In Vb 6?
hey guys on a form in a vb6 program it has a button and i want it so when one presses it it opens a wmv file. What coding could i use for it? thanks alot.

Open Files From VB
guys,

How do you open files (MS Word, MW Excel, PDF Files, etc.) from VB?
I've used the SHELL command before but does this only work for EXE files?
Any other way?

thanks!

Open Files
sir,
i created a application to view picture files.... i associated bmp files with my application... i can open bmp files by double clicking it.... what my problem is whenever i open another file it opens in another instance of my application... how can open all file in one application... i used
if app.previnstance=true then end in form load event to terminate another instance of my application....

plz help me..... urgent.....

How To Open Files
hi

im quite a noob to visual basic and am stuck on how to open files.
when i say open i dont mean for input/output i actually want to open it like you would double click it in explorer.

could anyone please tell me how to do this?

im using vb 6 btw


thanks

Open Files
I know this sounds sort of lame... I forgot how to open & run .exe files in vb6. Could someone help me?? (simple please, im still learning vb6)

<Help>Open .txt Files
Hi Guys,

I'm facing a problem in opening multible files and put the data into the specified file.

However, when I enter a data for a Customer Name & Phone Number it goes to the Customer.txt File but, when I enter a Product name , Price, Quantity on Hand and Critical Level of the Quantity it goes also to the Customer.txt File.

What I want it every data it has to go to the specified File.

The App is consist of Five Forms and each one it deals with diffirent porpuse. MainMenu, Customer, Product, Purchase and Invoice. In addition, all of thses forms should deal with .txt Files.

Could someone help me in this problem please?? The File is Attanched.

Thanks in advance.

Habibialby

How To Open Dll Files ?
hi,
is there a way to somehow open dll files and see its contents.
i mean can i view all the pictures and icons in a windows dll file and copy them some place else .
thanks

Hot To Open .DEP Files?
Hot to open .DEP files?

I need to see dependencies and later use INNO Installer.
But, witch program opens DEP files?

Thanks.
JCI

Open Files
I 've got a program which opens a specific infile1.txt document with that name but i wondering how to add a little file browser to the program so i can open any text file with it.

gooday

New To This. Want To Open Two Files
Hi, everyone, never used vb before but vba a little.

I'm trying to open two exel files with a script, but have no idea how to do this.
Files are located in C:Memor



Any ideas
Regards Keiser

How Many Files Open ?
Hi there,
I know how to open,save & close files but if I open one file and a second file, I don't see the first one anymore. I want to see how many files are open (just like ex. in Word under 'Window' etc...)
Does anyone have the code?
Many thx!!

Cant Open .doc Files...
hey, im making a text editor, and when i try to open .doc files, i get a runtime error 62

Open Files
When i click on a FileListBox (File1) how can i make it load the file im on i.e (wizhat.bmp) on a PictureBox (Picture1)

Thankyou,
Iwan

How To Open Files
Hi, guys. I'm back and I have a problem.

How can I open any file? For example, the user types in a path and vb opens the file( a doc, bmp,psd or any registered extension). Can you help me out?

How Can I Open Files ?
my programe can save its data to a notpadfile well just a file the format for the files are DD.MM.YY in my programme you type in the boxes on scresn and click save i want to be able to open the files which are saved in the local DIR and place the text in the correct places i also have check boxes for 5 of the boxes greatfullness - James

Open Files
I have a routine that opens quite a few text files at the same time. Since, I have no Idea at the start of the routine how many files will be opened(the code determines this based on the contents of other text files) I am using the FreeFile() function to get the file number for the open method.


Code:
filenumber1 = FreeFile()
Open pathii For Append As #filenumber1


Is there any way of programatically generating a list of all of the open files. I need to write an error handler that will close all of these text files if an error occurs in my routine.

Open Files?
how do i open files from the a: drive when i do open a:\.... it says the the :is bad
please help

Open Files...
Is there a way to open an entire file without having to put "" at the start and end?

In some file (e.g. .exe) there can be a " sign, can I ignore that so that all the text in the file is opend to e.g. text1?

Open Files?
how do i open other files from within vb

say for instance freecell as example

Open Files For Hex?
How can I open a file for HEX edition and go about changing the stuff in side the file..

i know it's a big question, but maybe someone can point me in the wright direction..


Thanks.

Open Txt Files Hm
Hi,

i want to open a txt file (could be quite large) and read all the txt from it so i can use my program to email it.. I have the emailing side sorted.. just need to work out how to open my file and send it as txt

Thanks!

OPEN Files
Hello,
How do you open a text file for editing?
Example.

I open a text file that has 3 lines.

textfile1
Hello this is vb world.
How are you today.
Wow im bored.
- end of file

Now how would i go about inserting an extra line w. out erasing the rest.

Thanks.

Open Files
Hi Guys
I have loads of file that I am extracting data from and sending to a database. I was wondering if someone could tell me how to open all files with a .txt extension and send it through my Parser.bas.
Thanks a lot for you help
It's greatly appreciated
JK

Open EXE Files
How can I have my app open an EXE file?

Open Files
Need Help:

I have a midi program made in VB, I would like this program to find all midi files in a directory and then play the firts one, when finish, the second one etc..
email: alexvazquez@yahoo.com

Best Regards,
Alejandro Vazquez

Open FIles In VB
How do you open any file inc exe's in VB
I think its got something to do with "shell"

Any suggestion (apart from common dialogs)

Thanks

Open Files From VB
Can I use the FileSystemObject or something else to open files that a user browses to. I don't want to access these files from VB, just launch them. This is for a Multimedia Presentation tool to tie all the Powerpoint, Director, HTML and Video files together.

Open Files With Their Corresponding App.
Anyone who got a code or idea for opening files with their corresponding application. Let's say I have a new document.doc, new spreadsheet.xls, new text.txt and a new program.exe in a listbox when I click new spreadsheet.xls the excel application will automatically launch and when I click program.exe it will run automatically or when I click new document.doc microsoft word will open or when I click a picture file let's say a .gif or .jpeg the internet explorer or an appropriate application will open to display the picture

please help

Too Many Files Open
Hi,

I have an VB6 Application that runs Crystal Reports 8.5 for user selected accounts, now if the user selects 40 different reports for lets say 20 accounts, then I will get 20 x 40 reports open with my viewer form, but if user selects one more account to run reports, then I get the "too many files open" error.

So, to try to bypass this problem, I am trying to dynamically copy the report file to a new uniquely generated file name, and run the report instance with the copied report file, that way I will always have only one instance for any given report, what can I say, its a very good idea, and it works too, with one BIG problem, the is a multi-user app (or so my client says) so, I need a way to kill the generated report file at the time the user closes the Report viewer form (at unload or terminate) because as long the form is open I should still have the report file name in the local variables, but I am getting the permission denied even after report is set to nothing and so on.

So how can I delete the report file right before the form is close?

Thanks
David Klein

Pls Help Me .... Is About Open Up 2 Files
hello guys... im having trouble to open up the 2 files , i tried so many times , but i can't think what's the right directory should i put at the '??????' .... the purpose is to pass the value of directory so it can read and open up 2 of the file that i want to open .... i do hope you could understand me and hopefully you can help me.... pls .....

Option Explicit

Private Sub CmdChkFile_Click()

Dim FileName As String
Dim a As String, b As String
Dim fs As FileSystemObject
Dim ts As TextStream, ts1 As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile("???????", ForReading)
Set ts1 = fs.OpenTextFile("??????", ForReading)
txtdata(0).Text = rtndirectory(Trim(CommonDialog1.FileName))
txtdata(1).Text = rtndirectory(Trim(CommonDialog1.FileName))

If txtdata(0).Text = "" Then Exit Sub
If txtdata(1).Text = "" Then Exit Sub


Do While Not ts.AtEndOfStream
a = ts.ReadLine
b = ts1.ReadLine
Loop

Debug.Print


End Sub

Private Sub cmdFileFmt_Click()

On Error GoTo err

CommonDialog1.Filter = ".hdr"
CommonDialog1.InitDir = App.Path & "BatchFile"
CommonDialog1.FileName = "Header"
CommonDialog1.ShowOpen

If Trim(CommonDialog1.FileName) = "" Then Exit Sub

txtdata(1).Text = rtndirectory(Trim(CommonDialog1.FileName))

Exit Sub
err:
MsgBox err.Description, vbCritical, "Error lines " + err.Number


End Sub


Private Sub Cmdsource_Click()
On Error GoTo err

CommonDialog1.Filter = ".Dat"
CommonDialog1.InitDir = App.Path & "BatchFile"
CommonDialog1.FileName = "DAT"
CommonDialog1.ShowOpen

If Trim(CommonDialog1.FileName) = "" Then Exit Sub

txtdata(0).Text = rtndirectory(Trim(CommonDialog1.FileName))

Exit Sub
err:
MsgBox err.Description, vbCritical, "Error lines " + err.Number

End Sub

Public Function rtndirectory(vdirectory As String) As String
Dim vtxt As Integer
vtxt = InStr(vdirectory, "\")
Do While Not vtxt = 0
vdirectory = Mid(vdirectory, 1, vtxt) & Right(vdirectory, Len(vdirectory) - (vtxt + 1))
vtxt = InStr(vdirectory, "\")
Loop
rtndirectory = vdirectory
End Function

Open Files/dir's
How can I tell if a file/folder is currently opened by another process? I want to rename a file/folder but occasionally it is being accessed (though read-only) by another process....
Thanks,
-lance

How To Open Xls Files From Vb?
How can I open an .xls file from vb?
Maybe with shell function?

Michael Vlastos
Automation Engineer
Company Modus SA
Development Department

Open Files Thru Vb.
I want to open a file from a VB application. The file could be an MP3 or could be an Excel file, or a Word Document or a JPEG Image.

How could I do that, using the same code to open all kind of file.

A friend recommend me to use API, but I don't know how to use it.
He said something about an OpenFile Function, but I don't remember.

Well let me know your opinion.

Open All Files
I am attaching .Doc/Xls/Txt/Rtf files into DBGrid. So user can open(double clicking the row) and edit the documents.It is working. Now user wants to attach any type of files; specially PDF and Word Perfect files. What is the best way to solve this problem? I am using Dialogbox Control.(How to use API?)

Thanks

Windows Open Files
All,

Is there a way to retrieve open files from a windows system as they appear.

Note : I found a function but it retrieve open files on a T time and not reading the stream ( takes more than 15 seconds for 5000 open files => I can only have the open files every 15 seconds and miss quite all of them )

Thanks in advance for your answers

Remy

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