robovacuum_2
New Member
- Joined
- Feb 2, 2020
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi all,
I have created the following code to update my word document (by refreshing links to cells in an external excel workbook) and then save as a new macro-free word document (including a dynamic file name that reflects the following day's date).
I would like to break all links to excel prior to saving the new word file, such that the new file can not be updated should the excel file be refreshed (I.e., the links in word would be replaced with the refreshed excel cell value alone rather than maintaining the link)
Has anyone done this before / able to assist here?
See current code below
-----------------------------------
Sub Update_links()
Dim objWord As Object
Dim objdoc As Object
Set objWord = CreateObject("Word.Application")
Set objdoc = objWord.documents.Open("C:\Users\Desktop\NPF v1.docm")
objWord.Visible = True
objdoc.Activate
Application.AskToUpdateLinks = True
objWord.Options.updatelinksatopen = refreshlinks
objdoc.SaveAs ("C:\Users\Desktop\today\" & "BB 1" & Format(Sheets("BB (dynamic)").Range("C14").Value, "dd-mmm-yy"))
objdoc.Close
End Sub
I have created the following code to update my word document (by refreshing links to cells in an external excel workbook) and then save as a new macro-free word document (including a dynamic file name that reflects the following day's date).
I would like to break all links to excel prior to saving the new word file, such that the new file can not be updated should the excel file be refreshed (I.e., the links in word would be replaced with the refreshed excel cell value alone rather than maintaining the link)
Has anyone done this before / able to assist here?
See current code below
-----------------------------------
Sub Update_links()
Dim objWord As Object
Dim objdoc As Object
Set objWord = CreateObject("Word.Application")
Set objdoc = objWord.documents.Open("C:\Users\Desktop\NPF v1.docm")
objWord.Visible = True
objdoc.Activate
Application.AskToUpdateLinks = True
objWord.Options.updatelinksatopen = refreshlinks
objdoc.SaveAs ("C:\Users\Desktop\today\" & "BB 1" & Format(Sheets("BB (dynamic)").Range("C14").Value, "dd-mmm-yy"))
objdoc.Close
End Sub