Consulting

Results 1 to 5 of 5

Thread: vba hos

  1. #1
    Banned VBAX Regular
    Joined
    Jul 2018
    Posts
    9
    Location

    Question vba hos

    Here in this code in word as i dont know how to use functions(ex:application.worksheetfunction in excel) i tried to create my own function but it is not working may be function creation is incorrect. so please answer me that is it possible to use something like application.worksheetfunction in word or shouldd we create our own function if so how?

    
    
    If wow.Value = True Then
    Select Case comb
    Case "addition"
    Call amrit(a, b, c)
    Case "subtraction"
    Call sam(a, b, c)
    End Select
    End If
    hide
    End Sub
    
    Sub sum(a As Variant, b As Variant, c As Variant)
    ThisDocument.TextBox10.Value = amrit(a, b, c)
    End Sub
    
    
    Sub minus(a As Variant, b As Variant, c As Variant)
    ThisDocument.TextBox10.Value = sam(a, b, c)
    End Sub
    
    
    Public Function amrit(a As Variant, b As Variant, c As Variant) As Variant
    amrit = a + b + c
    End Function
    
    
    Public Function sam(a As Variant, b As Variant, c As Variant) As Variant
    sam = a - b - c
    End Function
    Last edited by Paul_Hossler; 11-06-2018 at 09:55 AM.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    There is nothing like application.worksheetfunction in Word.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Banned VBAX Regular
    Joined
    Jul 2018
    Posts
    9
    Location
    so how to do addition , subtraction etc in word vba whether we should create own functions? if so please provide code.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by phoenixmoto View Post
    so how to do addition , subtraction etc in word vba whether we should create own functions? if so please provide code.
    This is not a free coding forum. Code for addition, subtraction etc. is trivial and you should invest some effort of your own learning such simple things instead of expecting others to do it for you.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cross-posted at: http://www.msofficeforums.com/word-v...-vba-word.html
    Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •