+ Reply to Thread
Results 1 to 12 of 12

ActiveDocument.Close error

  1. #1
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    ActiveDocument.Close error

    Hi guys,

    I have a code and it works perfectly, but because I use a template dotx I have an error when I am trying to close the document.
    In the excel appears a window to save the doc somewhere as dotm but i don;t want to do that. I simply need to close my active doc without saving anything etc.

    Can you please advise?
    Please Login or Register  to view this content.
    I think the line would need to be:
    Please Login or Register  to view this content.
    but is still not working. Maybe I need to put numbers instead of wdDoNotSaveChanges and wdOriginalDocumentFormat.
    I searched on MSN and I was not able to find the real numbers for them.

    Thank you in advance,
    Ionut

  2. #2
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: ActiveDocument.Close error

    You are using Late Binding (Unless you have added a Reference to Word in ther Tools.References menu) so you need to replace all the [wd...] constants, which only exist when Word is explicitly referenced, with the numeric equivalent.

    You can get these from the VBA environment in Word.

  3. #3
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    Hi,

    I have Microsoft Scripting Run time selected in VBA, despite I have the late binding in the name and I have the same issue.
    Is there another one I have to select?


    Thanks,
    Ionut

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,853

    Re: ActiveDocument.Close error

    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    Thank you! I taught the forums are different and not the same. will keep this in my mind.

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,853

    Re: ActiveDocument.Close error

    Quote Originally Posted by IonutC View Post
    I taught the forums are different and not the same.
    They are different: that's the whole point!

  7. #7
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    got it thanks!

  8. #8
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,853

    Re: ActiveDocument.Close error

    I see you're also carrying on the same discussion in this thread: http://www.excelforum.com/excel-prog...oc-to-pdf.html

    Please read the Duplicate Thread policy in rule #5: http://www.excelforum.com/forum-rule...rum-rules.html

  9. #9
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    Macropod I started the topic as save doc to pdf. when i saw that i got an error i created a new topic with the error i got, in meantime the discussion from pdf evolved to the one with error.

  10. #10
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    Hi,

    For future users that will have the same error please note that I had the error because I had a comma
    Please Login or Register  to view this content.
    and i should have:
    Please Login or Register  to view this content.
    Cheers and thanks to all!

    Ionut

  11. #11
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: ActiveDocument.Close error

    Hi,

    For future users that will have the same error please note that I had the error because I had a comma
    Please Login or Register  to view this content.
    and i should have:
    Please Login or Register  to view this content.
    Cheers and thanks to all!

    Ionut

  12. #12
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,853

    Re: ActiveDocument.Close error

    You should have kept the discussion in the original thread, as it's all part of the same issue you're having with automating Word. Saving a document as a pdf is little different than saving in any other format. Now you've got two discussions going with people working at cross-purposes and/or reinventing the wheel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 04-19-2016, 02:24 PM
  2. OLE Error : ActiveDocument.Select
    By Cheshire in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2010, 01:20 PM
  3. inputbox (error if close)
    By CatherineN in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2006, 02:10 PM
  4. ActiveDocument object not recognized
    By LauraBorealis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-14-2006, 04:55 PM
  5. run-time error '91'-Close Button error
    By ASCO IS Help in forum Excel General
    Replies: 1
    Last Post: 05-08-2006, 11:30 AM
  6. run-time error '91' - Close Button Error
    By ASCO IS Help in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2006, 01:10 PM
  7. Error on Close
    By bhofsetz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2005, 03:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1