Remove reference to template / document properties & Personal information on word

totalnovice2

Registered User.
Local time
Today, 07:01
Joined
May 21, 2013
Messages
36
I have a template word document saved on sharepoint.

I use an Click private sub on access to start the VBA which lifts information from access form fields and puts them into the word template in a pre-defined position.

The issue is that one of the customers gets the following error message when trying to open it...


"Cannot open https://office.me.com/sites/radioandriggingpermits/Auto/cust2 permit.dot"

Basically this customer's attachment is trying to connect to my template rather than the saved document. I have tried removeing the XML data on the template and tried adding coding to remove the link to the template after it has been pre-filled.

Please can anyone advise how I can remove the link to the template using VBA as I can do it if i open the file, click on File > check for issues > inspect > then remove whatever I want. I cannot work out how to remove the template reference though as the VBA on the below "ActiveDocument.RemoveDocumentInformation wdRDITemplate" doesn't work and I've used the "ActiveDocument.RemoveDocumentInformation wdRDIDocumentProperties" code too but this doesn't seem to work.

I've included the code which is used to send the email and attach the file to it in case someone thinks that that is the issue but this same code works fine for other customers.

I hope someone can help.

Many thanks.

Code:
Private Sub Command152_Click()
On Error Resume Next
 
'Declare the follwing
    Dim objWord As Word.Application
       'Set word as an application and make it invisible
         Set objWord = CreateObject("Word.Application")
         objWord.Visible = False 'True is visible
 
       'path and name of the template your are using.
         objWord.Documents.Add ("[URL]https://office.me.com/sites/radioandrigginpermits/Auto/cust2permit.dot[/URL]")
 
       'This is for the bookmark that you created in the template
         objWord.ActiveDocument.Bookmarks("VFCS").Select
 
       'This is the field in access that containts the data that has to be entered at the
       'bookmark
         objWord.Selection.Text = Forms![Front Page]![Site 2 Owner]
 
 
'Word (or the document that you created with the template, will now open)
    objWord.Visible = False
 
 
       ActiveDocument.RemoveDocumentInformation wdRDITemplate
 
 
      objWord.ActiveDocument.SaveAs FileName:="C:\Users\Public\" & " " & Forms![Front Page]![Combo79] & " " & "VF" & ".doc", FileFormat:=Word.WdSaveFormat.wdFormatDocument97
 
 
      objWord.ActiveDocument.Close
 
  Call Mail_Radio_Outlook2("C:\Users\Public\" & " " & Forms![Front Page]![Combo79] & " " & "VF" & ".doc")
 Set objWord = Nothing
 
 
End Sub
Function Mail_Radio_Outlook2(activedoc As String)
'Working in Office 2000-2010
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim acc_req As String
 
 
 
       Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
 
 
    strbody = "Hello.<br> <br> Please Find attached request for access. <br>"
 
   acc_req = "VF Access request" & "  " & [Forms]![Front Page]![Text98].Value & "  " & Forms![Front Page]![Site 2 Name].Value
 
      With OutMail
      On Error Resume Next
 
        .Display
        .To = "[EMAIL="customer2email@email.com"]customer2email@email.com[/EMAIL]"
        .CC = ""
        .Subject = acc_req
        .Attachments.Add (activedoc)
        .HTMLBody = strbody & "<br>" & .HTMLBody
        .Display
 
 
    End With
 
    Set OutMail = Nothing
    Set OutApp = Nothing
 
    MsgBox "Your E-mail has been sent to customer.", vbInformation + vbOKOnly, "E-mail Sent"
 
End Function
 
Last edited:
Re: Remove reference to template / document properties & Personal information on word

http://www.bettersolutions.com/word/WHN113/VU126266332.htm
Can't validate this myself.
It would appear that the template might need to be copied into a template object.
Then it can be modified as the current document, then on line 13, opened as a document.

At first this example seemed to be a little round-about-the-way, but it does seem to make sense if you follow it through.
Sorry I can't validate this due to workload.
 
Re: Remove reference to template / document properties & Personal information on word

Thank you very much.

I did try that but I couldn't seem to get it to work.

I have taken the decision to take the template offline and give all employees a copy of the template to keep on their hard drives.

This seems to have rectified the probelm but it isn't ideal if I need to make any changes etc.
 

Users who are viewing this thread

Back
Top Bottom