Reputation: 3
I'm on Excel 16.32 and I'm rewriting old windows VBA to convert it for Mac use instead (want to close our terminal server).
I have no problem with open and save files (sandboxing) and have got the most working. But the big issue is that I can’t get the pastespecial
with link:=true
to work.
So:
myDoc.Bookmarks.Item("FastBetRubr").Range.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine, DisplayAsIcon:=False, Link:=False
Is working
But:
myDoc.Bookmarks.Item("FastBetRubr").Range.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine, DisplayAsIcon:=False, Link:=True
Is not working and gives a 5345 error (no use error code).
We really need the links and if I make a break-point and then paste-special in word it works. It also works if just tries to paste-special normally.
The files are on a SMB share and I have tried to save both documents before pastespecial and without saving - no change.
Is this still a sandboxing error or is the Excel-Word pasting not working in Mac O365 ?
Upvotes: 0
Views: 669
Reputation:
It looks like an error (bug) in Mac Word. Either that, or Microsoft doesn't think people should be working with unencoded text on Mac. I get the same here on v16.31, and the same problem (with dialog box) when attempting to Paste Special with Link using text format.
Here, I can make it work by inserting the Link using the Unformatted Unicode Text option. To do that, use
myDoc.Bookmarks.Item("FastBetRubr").Range.PasteSpecial DataType:=22, Placement:=wdInLine, DisplayAsIcon:=False, Link:=True
Microsoft does not seem to have maintained the wdPasteDataType enumeration, so there is no built-in constant such as "wdUnicodeText" that you can use instead of the "22"
In this case, Word inserts a LINK field with an additional \u switch that specifies the Unicode encoding. If you remove that switch and try to update the field, you see an error message that suggests that Word can't find the file.
Upvotes: 1