+ Reply to Thread
Results 1 to 6 of 6

Get macros to open embedded documents

  1. #1
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Smile Get macros to open embedded documents

    Hello!

    I am trying to create a macro to add to a button that will open an embedded document (word, PPT, and excel).

    I recorded the macro and it works fine the first time I try to test it but after it tells me that there is an error...

    I'm not exactly sure what to do. Any help would be great. Unfortunately, I could not find what I needed on youtube so hopefully I can get help from your great minds!

    Error: It talks about the object being out of range and allows me to debug... the code that is in the developer is:
    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Sheets("Sheet2").Select
    Windows("Worksheet in Book1").Visible = True
    Selection.Verb Verb:=xlPrimary
    ActiveWindow.Close
    Sheets("Sheet1").Select
    End Sub


    The Windows line is what it tells me to fix.. from there I am lost... Is it because I am trying to do a double clicking function?

    Thanks!
    Last edited by ana2006bal; 06-11-2014 at 02:50 PM.

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Get macros to open embedded documents

    I see that this is your first post. Please use code tags when imbedding macro code. Thanks.

    In excel, when you create a new workbook and haven't yet saved it, the window name (e.g., Book1) doesn't have an extension. At the top of the excel window, it will say Book1 - Microsoft Excel. Once you have saved it, or if you open an existing workbook, the window name will include the extension (Book1.xlsx). I suspect that's your problem. The window name in your code doesn't have an extension, so it will work the 1st time, but won't find the window after it's been saved because the name is different. "Out of range" usually means it can't find the object your asking for.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Re: Get macros to open embedded documents

    Thank you so much! That worked for everything except when I embed another excel document... Any Idea as to why it's not working. The document is saved with a name... Here is the code it creates when I record the macro I want. It's saying out of range and asks me to debut... It's still highlighting the: Windows("Worksheet in test123.xlsm").Visible = True


    Code:

    Sub Macro3()
    '
    ' Macro3 Macro
    '

    '
    Sheets("Sheet2").Select
    ActiveSheet.Shapes.Range(Array("Object 8")).Select
    Windows("Worksheet in test123.xlsm").Visible = True
    Selection.Verb Verb:=xlPrimary
    Windows("test123.xlsm").Activate
    Sheets("Sheet1").Select
    End Sub

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Get macros to open embedded documents

    Again, please edit your post and put code tags around macro code as requested in the forum rules.

    What menu steps are you using to imbed the documents?

  5. #5
    Registered User
    Join Date
    06-11-2014
    Posts
    5

    Re: Get macros to open embedded documents

    I'm really sorry.. I have no clue what you mean by that...


    I am doing what worked for the other types of documents:
    Go to ribbon> Click record macro
    Click on sheet with document > double click document
    click back on main sheet
    God to ribbon > Stop recording.

  6. #6
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Get macros to open embedded documents

    Sorry, I'm asking how you imbedded the documents to being with.

+ 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. Hyperlink to Embedded PDF documents - Please Help!!
    By mininax in forum Excel General
    Replies: 1
    Last Post: 11-08-2012, 03:25 PM
  2. Replies: 1
    Last Post: 03-14-2012, 12:25 AM
  3. Embedded Word Documents
    By ani4ani in forum Excel General
    Replies: 0
    Last Post: 10-13-2009, 04:16 AM
  4. open and manipulate embedded word documents from excel?
    By mcledavid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2009, 04:24 PM
  5. Using VBA to work with Embedded Documents
    By rboote in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2008, 03:22 PM

Tags for this Thread

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