Issue with Compatibility from 2010 and 2013 excel to word

jcrone

New Member
Joined
Mar 15, 2016
Messages
15
I am having an issue with code running on 2010 excel but not 2013. It opens up a word doc on a shared drive and fills the form out. I would like to know if any one has had this issue.

In both 2010 and 2013 version it opens the word doc but only in the 2010 does it fill out the form.

Code:
    Set wd = GetObject(, "Word.Application")
    If Err.Number <> 0 Then
        Set wd = CreateObject("Word.Application")
    End If
     
     ' ################################
     ' Word Activate
    wd.Visible = True
    AppActivate wd.Name
    
     ' ################################
    
    If obco = True Then
    With wd
        documentoWord = "FORM - Change Order.doc"
        .ChangeFileOpenDirectory Path
        .Documents.Open filename:=documentoWord, ReadOnly:=True
         
         ' ################################
         ' ... and try to fill the form
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text4") = Sheets("User Settings").Range("D11")
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text24") = txtrequest & " / " & txtcrequest
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text6") = Format(Sheets("Filter").Range("O1"), "m/d")
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text3") = txtdate & " " & txttime
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text19") = txtchange
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text26") = txtcc
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text5") = txtcampus
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text7") = cbcat & "-" & txtqty
        .Selection.Goto(What:=wdGoToBookmark, Name:="Text2") = titleName
    
    End With
    End If
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Does it work if you change the bookmark code to this sort of thing?
Code:
.ActiveDocument.Bookmarks("Text4").Range.InsertAfter Sheets("User Settings").Range("D11")
.ActiveDocument.Bookmarks("Text24").Range.InsertAfter txtrequest & " / " & txtcrequest

' etc
 
Upvote 0
Does it work if you change the bookmark code to this sort of thing?
Code:
.ActiveDocument.Bookmarks("Text4").Range.InsertAfter Sheets("User Settings").Range("D11")
.ActiveDocument.Bookmarks("Text24").Range.InsertAfter txtrequest & " / " & txtcrequest

' etc


Thanks for the suggestion, that did not work for me. This code is inside my excel userform if that makes a difference.
 
Upvote 0
Do you have On Error... in the code?

If you do what happens if you comment it out and run the code again?
 
Upvote 0
Do you have On Error... in the code?

If you do what happens if you comment it out and run the code again?
I don't get any errors. I am stubbed, it will work on the computers running excel 2010 but not 2013. I tried to write the code a couple different ways and no luck with it working on 2013 excel

When I run the debugger it seems like it should work.
 
Upvote 0
Do you have On Error... in the code?

If you do what happens if you comment it out and run the code again?


So I think I found the issue, but I don't have an idea how to fix it. The document in opens in word 2013 and you have to do an additional step to edit the document
 
Upvote 0
Can you post the whole code?

This issue has been resolved, if the person has "Open e-mail attachments in Full Screen Reading View" checked in their Word Options > General settings> Start up options then the code would not fill in the bookmarks. Thanks for your help on this
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top