Working with VBA

Since SeoTools 6.0, most functions run asynchronously. This offers many advantages, such as greatly reduced calculation time and the ability to do other things in Excel while the calculations are running. However, this also means that VBA scripts, which relies on copying and pasting results, will fail. In order to fix this, users may temporarily make Async functions run synchronously.

Disable Async

  1. Open SeoTools.Config.Xml

  2. Add the following line according to the picture below:
    <RunAsyncUdfsSynchronously>true</RunAsyncUdfsSynchronously>


Example Scripts

  1. Extracting Twitter User Bio with XPathOnURL

    Sub GetBio()
      Dim row As Integer
      Dim col As Integer
      row = 2
      col = 2
      While ActiveSheet.Cells(row, 1) <> ""
      ActiveSheet.Cells(row, col) "=XPathOnUrl(A" & row & ", ""//p[@class='ProfileHeaderCard-bio u-dir']"")"
      ActiveSheet.Cells(row, col).Copy
      ActiveSheet.Cells(row, col).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
      :=False, Transpose:=False
      row = row + 1
     Wend
    End Sub

2. Extracting an array of all links with CsQueryOnUrl

    Sub GetLinks()
      Dim row As Integer
      Dim col As Integer
      row = 2
      col = 2
      Dim range As Variant
      Dim addr1, addr2 As String
      While Sheets("Example").Cells(row, 1) <> ""
        Dim xArray() As Variant
        xArray =  Evaluate("=TRANSPOSE(CsQueryOnUrl(A" & row & ",  ""a"", ""href""))")
         addr1 = Sheets("Example").Cells(row,  col).Address
         addr2 = Sheets("Example").Cells(row, col).Offset(0, UBound(xArray) - 1).Address
         Sheets("Example").range(addr1 & ":" & addr2).Value = xArray
       row = row + 1
       Wend
     End Sub

See

Cookbook

Guides

Related Functions


Get help with this function in the community →