Help setting default file names 
Author Message
 Help setting default file names

Is there anyway I can set the default file name for a file I wish to create
from user input data?
I have a Var which is FullName and it contains the Full Name for the user, I
want to put this name as the defult and a .TXT extention...

Anyone?

Wade



Tue, 23 Apr 2002 03:00:00 GMT  
 Help setting default file names


Quote:
> Is there anyway I can set the default file name for a file I wish to
create
> from user input data?
> I have a Var which is FullName and it contains the Full Name for the
user, I
> want to put this name as the defult and a .TXT extention...

> Anyone?

> Wade

The short answer is YES, but I need more information. How are you
getting the filename from the user?  If, for example, you're using the
CommonDialog control, you would set CommonDialog1.filename to the
default before doing the .ShowOpen method.

CommonDialog1.FileName = "MyDefault.txt"
CommonDialog1.ShowOpen  ' returns User's filename choice

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 23 Apr 2002 03:00:00 GMT  
 Help setting default file names

Dim f&
f=freefile

Open "C:\Documents\" & NameVar & ".txt" for Output as #f
    Print #f, UserTextString
Close #f

_____________________________________________________

Oliver Keeling
www.Keeling-net.co.uk
ICQ 5566220

Chaos, panic, & disorder - my work here is done.


Is there anyway I can set the default file name for a file I wish to create
from user input data?
I have a Var which is FullName and it contains the Full Name for the user, I
want to put this name as the defult and a .TXT extention...

Anyone?

Wade



Tue, 23 Apr 2002 03:00:00 GMT  
 Help setting default file names
This is my routine so far...
Feel free to mak any suggestions about the code... I'm about 30Hrs new...

Private Sub cmdOK_Click()
'When user clicks OK , the inputed data is saved to a text file
Dim Prompt, info
info = "Please Enter Your Name!"
    If FullNameTxt.Text = "" Then
        MsgBox (info)
        Else:

Dim Prompt1, Loc
Loc = "Please Enter Your Location and Dept!"
    If DeptTxt.Text = "" Then
        MsgBox (Loc)
        Else:
Dim Prompt2, Contct
Contct = "Please Enter Some Contact Information!"
    If ContactTxt.Text = "" Then
        MsgBox (Contct)
    Else:
       CommonDialog1.Filter = "Text files (*.TXT)|*.TXT"
       CommonDialog1.InitDir = "Data_Path_Here"
       CommonDialog1.ShowSave  'display Save dialog
       If CommonDialog1.filename <> "" Then
            Open CommonDialog1.filename For Output As #1
            Print #1, FullName & Dept & Contact 'save string to file
            Close #1                'close file

            Unload Form1
            Load Form2
            Form2.Show
        End If
    End If
  End If
 End If
End Sub


Quote:


> > Is there anyway I can set the default file name for a file I wish to
> create
> > from user input data?
> > I have a Var which is FullName and it contains the Full Name for the
> user, I
> > want to put this name as the defult and a .TXT extention...

> > Anyone?

> > Wade

> The short answer is YES, but I need more information. How are you
> getting the filename from the user?  If, for example, you're using the
> CommonDialog control, you would set CommonDialog1.filename to the
> default before doing the .ShowOpen method.

> CommonDialog1.FileName = "MyDefault.txt"
> CommonDialog1.ShowOpen  ' returns User's filename choice

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 24 Apr 2002 03:00:00 GMT  
 Help setting default file names
This is my routine so far...
Feel free to mak any suggestions about the code... I'm about 30Hrs new...

Private Sub cmdOK_Click()
'When user clicks OK , the inputed data is saved to a text file
Dim Prompt, info
info = "Please Enter Your Name!"
    If FullNameTxt.Text = "" Then
        MsgBox (info)
        Else:

Dim Prompt1, Loc
Loc = "Please Enter Your Location and Dept!"
    If DeptTxt.Text = "" Then
        MsgBox (Loc)
        Else:
Dim Prompt2, Contct
Contct = "Please Enter Some Contact Information!"
    If ContactTxt.Text = "" Then
        MsgBox (Contct)
    Else:
       CommonDialog1.Filter = "Text files (*.TXT)|*.TXT"
       CommonDialog1.InitDir = "Data_Path_Here"
       CommonDialog1.ShowSave  'display Save dialog
       If CommonDialog1.filename <> "" Then
            Open CommonDialog1.filename For Output As #1
            Print #1, FullName & Dept & Contact 'save string to file
            Close #1                'close file

            Unload Form1
            Load Form2
            Form2.Show
        End If
    End If
  End If
 End If
End Sub


Quote:


> > Is there anyway I can set the default file name for a file I wish to
> create
> > from user input data?
> > I have a Var which is FullName and it contains the Full Name for the
> user, I
> > want to put this name as the defult and a .TXT extention...

> > Anyone?

> > Wade

> The short answer is YES, but I need more information. How are you
> getting the filename from the user?  If, for example, you're using the
> CommonDialog control, you would set CommonDialog1.filename to the
> default before doing the .ShowOpen method.

> CommonDialog1.FileName = "MyDefault.txt"
> CommonDialog1.ShowOpen  ' returns User's filename choice

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 24 Apr 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. HELP HELP HELP Set document name of print job from VB HELP HELP HELP

2. Set default-name for menu-item save

3. Setting Printer Defaults based on Computer Name

4. setting a printer to print to a file and specify a file name

5. How to specify default file name ?

6. Saving a file with a default name.

7. Supplying Default File Name in Save window

8. show save as dialog with default doc path but current file name

9. CommonDialog and default file name

10. default file name

11. Setting default folder when saving files during VB6 development

12. Project Name Default, your Help Pls.

 

 
Powered by phpBB® Forum Software