+ Reply to Thread
Results 1 to 7 of 7

Opening a word document from excel and goto a specific page - question

  1. #1
    Registered User
    Join Date
    01-28-2013
    Location
    Sussex, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Opening a word document from excel and goto a specific page - question

    I have an Excel document which I have inserted some VBA code to open a word document;

    Please Login or Register  to view this content.
    But I also want it to navigate to a page of my choosing, in this example, I have chosen page 8 as a random example;

    Please Login or Register  to view this content.
    But this just opens up the document and goes to page 29, which happens to be 'section' 8

    I also tried this;

    Please Login or Register  to view this content.
    But the debugger stopped it because it thinks that there is a syntax error

    Could someone please explain the full method and give an example of the code that you place in Excel to open up a word document and navigate to a specific page

    BTW - the same question has been asked here;
    http://www.mrexcel.com/forum/excel-q...d-go-page.html

    Many thanks,
    Scooble
    Last edited by scooble; 01-28-2013 at 07:28 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Opening a word document from excel and goto a specific page - question

    cross posted at
    http://www.mrexcel.com/forum/excel-q...d-go-page.html
    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    01-28-2013
    Location
    Sussex, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Opening a word document from excel and goto a specific page - question

    Ok, sorry about that, but I thought there would be a better chance of a response. If it helps, please ignore the post on the Mr Excel board.

    ...oh, btw, do you have any suggestions in fixing the problem?

    thanks

  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,726

    Re: Opening a word document from excel and goto a specific page - question

    try something based on:
    Please Login or Register  to view this content.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Registered User
    Join Date
    01-28-2013
    Location
    Sussex, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Opening a word document from excel and goto a specific page - question

    Many thanks for the response, however, I copied and pasted the code from above and pasted it underneath the code that opens the word document, the code opened up the word document, but I got an error that said;
    Runtime Error '424':
    Object required


    and the debugger stopped at the line with the following code;
    Please Login or Register  to view this content.
    I think the debugger has a problem with the name 'ActiveDocument', I believe that this is not a valid Excel VBA object (although I could be wrong).

    Some of the advice I have already received is from people who are trying to make the document go to a certain page by using code within Word, however, I am trying to make Word do things from within Excel. I don;t even know if its even possible.

    I have some reasonable experience with VBS, but some of these lines VBA lines of code contain all manner of attributes which I have no idea what they do or what contextual format what they should be in, so essentially, I am a bit of a noob, so please excuse my ignorance
    Last edited by scooble; 01-30-2013 at 12:26 PM. Reason: adding stuff

  6. #6
    Registered User
    Join Date
    01-28-2013
    Location
    Sussex, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Opening a word document from excel and goto a specific page - question

    Many thanks for the response, however, I copied and pasted the code from above and pasted it underneath the code that opens the word document, the code opened up the word document, but I got an error that said;
    Runtime Error '424':
    Object required


    and the debugger stopped at the line with the following code;
    Please Login or Register  to view this content.
    I think the debugger has a problem with the name 'ActiveDocument', I believe that this is not a valid Excel VBA object (although I could be wrong).

    Some of the advice I have already received is from people who are trying to make the document go to a certain page by using code within Word, however, I am trying to make Word do things from within Excel. I don't even know if its even possible.

    I have some reasonable experience with VBS, but some of these lines VBA lines of code contain all manner of attributes which I have no idea what they do or what contextual format what they should be in, so essentially, I am a bit of a noob, so please excuse my ignorance

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

    Re: Opening a word document from excel and goto a specific page - question

    As I said, "try something based on" - I didn't say to use the code as-is. You need to replace 'ActiveDocument' with whatever variable you're using to identify the document. The code you've posted so far doesn't show that; only what you're using for the Word application (WordApp). Alternatively, you might be able to use 'WordApp.ActiveDocument'.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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