Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Common dialog control with "Open for append"

Status
Not open for further replies.

wwwwill

Programmer
Jan 13, 2003
18
US
I want to allow the user to name the file that will be created. Can I use the commondialog control to facilitate that? If so what would that code look like? Also, does anyone know of a good tutorial on using the commondialog control? The code below is how I've been naming the file.

Thanks
Code:
Open "C:\Aplace\output\" & ntime2 & ".atb" For Append As #1
            Print #1, strAttributes & strName
Close #1
 
Yes, you'd use the GetOpenFilename dialog to get the name of the file you're trying to open, and then use the normal
open strMyFile for append as #1 (or whatever)
to actually open it.

You could use

strMyFile = Application.GetOpenFilename("data files (*.atb),*.atb", 1, _
"Select data file")


Rob
[flowerface]
 
I'm still confused as to how this would relate to the "open" statement. How does the 'showsave' method relate to the 'open' statement, sequentially. I don't have the MSDN loaded so I can't access any examples of using the commondialog control and the order of operation regarding it. Does the commondialog obviate the need for the 'open' statement or do you use both of them? If you know of any good tutorials that would also help.

Thanks,

w
 
I'm not sure what the showsave method is. As for the sequence to open, it would be something like:


strMyFile = Application.GetOpenFilename("data files (*.atb),*.atb", 1, _
"Select data file")
open strMyFile for append as #1

The GetOpenFilename puts up the file open dialog, and allows the user to select a file, browse through folders, etc. It doesn't actually do any file open itself, it just returns the filename. Try it, and see how it works for you.
Rob
[flowerface]
 
I don't have that method 'getopenfilename.' (VBA in Autocad Map) I do have 'freefile.' And that works, thanks for you help. Is 'getopenfilename' an Office VBA method, or VB6?
 
I'm not familiar at all with VBA in AutoCAD (anybody?), but I would think it would have something like the GetOpenFilename method. Yes, I'm talking about Office VBA. By the way, please specify which product you work with - that will get you a more targeted response.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top