Howdy, Stranger!

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

Categories

Writing to a document

Hi, I was wondering if anyone could help me.

I know how to get the input from a user in visual basics,

however, I cannot seem to be able to print it in a document.


For example, I ask the user, "how old are you".. and he/she'll say

.. 21.. and I want to be able to put that number on the

document. I have assigned the answer, in this case 21, as a

variable but when I write


Print , it doesn't work. I was wondering

if anyone can help?


Thankyou.


Comments

  • : Hi, I was wondering if anyone could help me.

    : I know how to get the input from a user in visual basics,

    : however, I cannot seem to be able to print it in a document.


    : For example, I ask the user, "how old are you".. and he/she'll say

    : .. 21.. and I want to be able to put that number on the

    : document. I have assigned the answer, in this case 21, as a

    : variable but when I write


    : Print , it doesn't work. I was wondering

    : if anyone can help?


    : Thankyou.


    -----------------------


    You can output variables with

    Print VariableName

    on the form.


    However, normally you will write it not to

    the form, but to another control, a label

    or a textbox. this is done by assigning the

    variable value to either the .Text or .Caption

    members of the appropriate control.


    Text1.Text=VariableName

    Label1.Caption=VariableName


    hope this helps

    -nv




  • : Hi, I was wondering if anyone could help me.

    : I know how to get the input from a user in visual basics,

    : however, I cannot seem to be able to print it in a document.


    : For example, I ask the user, "how old are you".. and he/she'll say

    : .. 21.. and I want to be able to put that number on the

    : document. I have assigned the answer, in this case 21, as a

    : variable but when I write


    : Print , it doesn't work. I was wondering

    : if anyone can help?


    : Thankyou.

    Reference the Microsoft office file for word. Then place this code to insert the info into a word file and then print it out.


    Private Sub PrintAge()

    Dim age as string

    let age = inputbox("Enter your age please")

    Dim wrd as word.application

    Set wrd = createobject("word.application.8")

    Wrd.insertafter age

    Wrd.printout

    set wrd = nothing

    End Sub


  • Andre YoungAndre Young USAMember Posts: 0

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

Sign In or Register to comment.