I am running a macro through the normal.dot file. What I want to do is assign ActiveDocument.path to a variable. But when I do this I the error "Invalid Outside Procedure". What am I doing wrong?
My code:
path2file = ActiveDocument.path
sfile = FreeFile
Open path2file For Input As #sfile
Do While Not EOF(sfile)
intLine = intLine + 1
Line Input #sfile, strbuffer
LookforKeywords strbuffer
Loop
Close #sfile
ActiveDocument.Close
End Sub
My code:
path2file = ActiveDocument.path
sfile = FreeFile
Open path2file For Input As #sfile
Do While Not EOF(sfile)
intLine = intLine + 1
Line Input #sfile, strbuffer
LookforKeywords strbuffer
Loop
Close #sfile
ActiveDocument.Close
End Sub