# Convert .spf files (Shorthand) into Microsoft Word Autocorrect?



## techgirl (May 9, 2016)

I have this software called "Shorthand for Windows" by OfficeSoftLLC.  I need to be able to export or convert .spf files (Shorthand) to .txt files for Autocorrect?  Or a way to import the .spf entries directly into an autocorrect file ??  The company does NOT have a converter, and Microsoft has no idea how to do this.  Any help would be great.


----------



## shg (May 9, 2016)

> *How do I print the contents of a dictionary?*
> 
> You can print the contents of a dictionary to a text file by selecting "Print to File" from the File Menu.


That doesn't work?


----------



## techgirl (May 9, 2016)

No.  When I PrintFile from the software, it only exports the first line, and there are 571 entries.


----------



## shg (May 9, 2016)

Is "PrintFile" the same as "Print to File"?

If the company has said they don't have a converter, what do they say about only printing the first line?


----------



## Macropod (May 10, 2016)

techgirl said:


> I have this software called "Shorthand for Windows" by OfficeSoftLLC.  I need to be able to export or convert .spf files (Shorthand) to .txt files for Autocorrect?


Converting your to txt files is one thing; converting them to Word's AutoCorrect .acl files is quite another. Those are not simple text files as you will see if you navigate to:
C:\Users\%Username%\AppData\Roaming\Microsoft\Office\
and open one in, say, NotePad.

Once you have the .spf files converted to text files, you'd need to reduce them to basically two columns, perhaps in CSV or tab-separated format, so you could add the entries to Word via a macro that processes each entry in the form of:
AutoCorrect.Entries.Add Name:="AAA", Value:="BBB"
where "AAA" is the text to be replaces and "BBB" is the replacement.

Before running such a macro, you'd probably need to eliminate any entries that already appear in Word - I have no idea what would happen with duplicates.

Having had a look at the OfficeSoftLLC site and the way its autocorrects are constructed, I'm not overly confident that even with all this re-processing they'd translate directly into something Word could use.


----------



## techgirl (May 10, 2016)

Our programmer was able to convert the file to an excel file.  So is there an easy way to import this into an acl file ??


----------



## shg (May 10, 2016)

With input like this ...


A​B​1​Test1Testout12​Test2Testout2

... this worked fine for me:


```
Sub AutCorrect()
  Dim appWd         As Word.Application
  Dim iRow          As Long

  Set appWd = New Word.Application
  For iRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
    appWd.AutoCorrect.Entries.Add Name:=Cells(iRow, "A").Value, _
                                  Value:=Cells(iRow, "B").Value
  Next iRow

  appWd.Quit
End Sub
```
I didn't see any deleterious effects of running it twice.


----------



## techgirl (May 11, 2016)

Thank you.  But do I add this code into Excel or Word?  I've tried both and neither work.  In word, I get a compile error at the "Cell" entry, in excel it stops at the Word.application.  Not sure how to set this up.  ??


----------



## shg (May 11, 2016)

Sorry --it goes in Excel, and you need to set a reference to Word: Tools > References, tick _Microsoft Word X.X Object _Library.

EDIT: Or, still in Excel, you could late-bind and not set a reference:


```
Sub AutCorrect()
  Dim iRow          As Long

  With CreateObject("Word.Application")
    For iRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
      .AutoCorrect.Entries.Add Name:=Cells(iRow, "A").Value, _
                               Value:=Cells(iRow, "B").Value
    Next iRow
    .Quit
  End With
End Sub
```


----------



## techgirl (May 11, 2016)

Thank you, it worked perfect.  Now, may I ask two final questions... 1.  If I import another file, does it overwrite my existing .acl words?  2.  I tried to change the word "add" in the VB code, to ."delete" and it does NOT remove them, I get a VB error.  What is the code to remove an entry?


----------



## techgirl (May 9, 2016)

I have this software called "Shorthand for Windows" by OfficeSoftLLC.  I need to be able to export or convert .spf files (Shorthand) to .txt files for Autocorrect?  Or a way to import the .spf entries directly into an autocorrect file ??  The company does NOT have a converter, and Microsoft has no idea how to do this.  Any help would be great.


----------



## shg (May 11, 2016)

You're welcome.

Post your code.


----------



## shg (May 11, 2016)

```
Sub UnAutoCorrect()
  Dim iRow          As Long

  With CreateObject("Word.Application")
    For iRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
      .AutoCorrect.Entries(Cels(iRow, "A").Value).Delete
    Next iRow
    .Quit
  End With
End Sub
```


----------



## techgirl (May 12, 2016)

You are wonderful, it worked perfect for adding and deleting.  I am not savvy with VB code and would like to be, but just never too time.  Thank you very much for your expertise.


----------



## shg (May 12, 2016)

You're welcome.


----------

