cathgilloz Posted September 2, 2010 Share Posted September 2, 2010 I've wanted to be able to do this for the longest time - this macro inserts the file number in the comments box of the Word file properties - you could change it to add it to a header/footer, etc. If a query comes back on a typed document, I want to be able to easily find the associated sound file. Some of our authors dictate lots of sound files, but they want them typed as one document - in this case, the macro adds a comma and then the next sound file number. Function RegKeyRead(myRegKey As String) As String Dim myWS As Object 'using Windows Scripting (WS) because VB get settings can 'only examine a small area of the registry Set myWS = CreateObject("WScript.Shell") RegKeyRead = myWS.RegRead(myRegKey) End Function Sub GetCurrentFileName() Dim myRegKey As String myRegKey = "HKEY_CURRENT_USER\Software\NCH Swift Sound\Scribe\Settings\currentfile" 'this calls the RegKeyRead function and passes it the registry edit info myValue = RegKeyRead(myRegKey) 'the next line reads the dictation number from the .dat file myFileNumber = System.PrivateProfileString(myValue, "file", "number") 'if the comments box is currently empty, this inserts the file number. If it isn't 'empty, it takes the current contents, adds a comma, a space, and the file number If ActiveDocument.BuiltInDocumentProperties("Comments") = "" Then ActiveDocument.BuiltInDocumentProperties("Comments") = myFileNumber Else myNewComment = ActiveDocument.BuiltInDocumentProperties("Comments") & ", " & myFileNumber ActiveDocument.BuiltInDocumentProperties("Comments") = myNewComment End If End Sub Link to comment Share on other sites More sharing options...
gyoung Posted May 25, 2011 Share Posted May 25, 2011 Bump! I am trying to do this but I cannot get it to work. Can someone help? Has something changed in the software since this has been written? I really, really need to be able to copy the current file name with a hotkey or a macro. Any help is much appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now