I've recently migrated to iMac but continue to run Windows 7 on a virtual machine. (The reason is that Word 2016 for Mac is not as customizable as Word 2013 for Windows.)
But I'm having trouble with the macro below that used to sync Word.OfficeUI across multiple Windows machines so well.
I think the reason it's not working on the virtual machine is simple -- Microsoft Office now resides on C:, while the Dropbox now resides on a different drive. (OS X has its own Dropbox, and I didn't want to create a duplicate Dropbox on the virtual machine. So I just point to the templates on the iMac's Dropbox from Word's File Locations. iMac's Dropbox is mapped as a network drive from the virtual machine's perspective.)
Is there a fix for this? In other words, is there a way to differentiate "strProfile" below between the local Word.OfficeUI and the Dropbox's Word.OfficeUI?
Code: Select all
Sub Test()
Dim fso As Object
Dim strProfile As String
Dim strPath1 As String
Dim strPath2 As String
Dim fil1 As Object
Dim fil2 As Object
Set fso = CreateObject("Scripting.FileSystemObject")
strProfile = Environ("UserProfile")
strPath1 = strProfile & "\DropBox\Word.officeUI"
Set fil1 = fso.GetFile(strPath1)
strPath2 = strProfile & "\AppData\Local\Microsoft\Office\Word.officeUI"
Set fil2 = fso.GetFile(strPath2)
If fil1.DateLastModified < fil2.DateLastModified Then
fso.CopyFile strPath2, strPath1, True
ElseIf fil1.DateLastModified > fil2.DateLastModified Then
fso.CopyFile strPath1, strPath2, True
End If
End Sub