thanks, I don't mean to export word from module which is the next step

currently, what I met is that the following command line version cannot be 
compiled, 
    
    
    R:\CheckIt.nim(709, 5) Error: undeclared identifier: 'word'
    
    
    Run

because there is no global variant word so checkHeading and checkPunctation can 
not find it
    
    
    # I am command line version
    
    proc checkHeading() =
        word.Selection.HomeKey(...)   #  **this line can't find variant word, 
so the compilation can't succeed**
        do some check on Heading, then display message
    
    proc checkPunctation() =
        word.Selection.HomeKey(...)
        do some check on punctaion, then display message
    
    proc check(fn)=
        var word = CreateObject("Word.Application") # how to declare a global 
`word` as the python version does?
        
        word.Documents.Open(fn, True)
        
        checkHeading()
        checkPunctation()
    
    when isMainModule:
        check(r"c:\test.doc")
    
    
    Run

Reply via email to