(Solved) – Compiling issues when outside vba environment

(solved)-–-compiling-issues-when-outside-vba-environment

I have the following code:

Sub vbRemoveSpacing()

    Dim doc As Document
    Set doc = Documents.Open("C:/Document.docx")
    For Each tbl In doc.Tables
        With tbl
            With .Range.ParagraphFormat
                .SpaceBefore = 0
                .SpaceBeforeAuto = F
                .SpaceAfter = 0
                .SpaceAfterAuto = F
            End With
            .Rows.SetHeight RowHeight:=0.1, HeightRule:=wdRowHeightAtLeast
        End With
    Next

    doc.Close (True)
End Sub

And I want to be able to run it from a .vbs file. Copying it into a .vbs file and running it gives an error

Line: 3
Char: 13
Error: Expected end of statement

Even removing that line of code returns a similar error later on with .Rows.SetHeight... having a similar issue. What’s going wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *