Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Please help

image





Comments

  • Do you need help displaying save/open/print dialog boxes? Or the code to do the actual saving/openeing/printing?


  • : Do you need help displaying save/open/print dialog boxes? Or the code to do the actual saving/openeing/printing?


    both


  • Here's an example for the "Open" box:




    On Error GoTo CancelSelected

    'Sets the filters for file types

    CMDialog1.Filter = "Text (*.txt)|*.txt|All Files (*.*)|*.*"

    'Picks the filter to show when the box first opens

    CMDialog1.FilterIndex = 1

    'Shows in the filename box and sets the pattern

    CMDialog1.Filename = "*.txt"

    'Causes an error if the user picks cancel so that you know for a fact cancel was selected

    CMDialog1.CancelError = True

    'Opens the box

    CMDialog1.Action = 1


    Once the user selects a file, it can be gotten using:


    FileName = CMDialog1.FileName




    For a "Save" box, add the following line somewhere before the"CMDialog1.Action" line:


    CMDialog1.DefaultExt = "TRT"


    and set CMDialog1.Action to 2.

    Again, the filename is gotten by:


    FileName = CMDialog1.FileName




    I don't remember the printer box code and my help files say the commondialog topics can't be found.


    To save a file (there are MANY ways, this is just one):


    Open FileName For Output As 1

    Print #1, TextToSave

    Close


    To open a file (again, MANY ways):


    Open FileName For Input As 1

    TextToGet = Input(LOF(1), 1)

    Close


    To print a ASCII (standard text) file (MANY ways, again):


    After getting the file's contents using a method such as the one above:


    Printer.Print TextToGet

    Printer.EndDoc



    For more info, search in the help files for:


    CommonDialog

    Open

    Input

    Print #

    Printer


    Hope this helps!


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ___ [ http://forcoder.org ] free video tutorials and ebooks about { C# Go PHP Visual Basic .NET Delphi Objective-C MATLAB Ruby Swift Assembly Python C Perl Visual Basic PL/SQL Scratch R Java C++ JavaScript Ada Prolog Hack Alice FoxPro Dart VBScript Julia SAS Apex Logo Rust Scala Kotlin Transact-SQL D Crystal Lisp Bash Scheme Erlang F# COBOL LabVIEW Lua Clojure Awk Fortran ML ABAP } _____

Sign In or Register to comment.