+ Reply to Thread
Results 1 to 21 of 21

Copied excel table to Word, but need Word opening in landscape

  1. #1
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    139

    Copied excel table to Word, but need Word opening in landscape

    Im not sure if this is possible or not, so I wanted to reach out. I currently have a macro to copy my excel table and have this table opened up in Word...and it works great. The only other thing I am trying to do is have this table viewed in landscape when word opens up instead of changing it to landscape within Word every single time I use this macro. Is this at all possible?

    If there's a better way to have these tables fully viewable in word without changing it to landscape in general or changing anything within Word itself, then please inform me. I will not be the one viewing these copied tables, which is why I am asking if theres a way to code this so these tables are fully viewable upon Word opening up.

    Here's the working code I have that opens up the copied table in Word...if that matters:

    Please Login or Register  to view this content.
    Thanks!
    Last edited by jennis7242; 05-14-2018 at 06:25 PM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2019
    Posts
    6,655

    Re: Copied excel table to Word, but Word opening in landscape

    May I ask why you want it in Word?
    You don't mention anything else like if it's part of a report or so or is it just that you don't what to send the the whole Excel file?
    If this last is the reason you can format the worksheet as you would when you print it and then save the worksheet as loose PDF file.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    139

    Re: Copied excel table to Word, but Word opening in landscape

    Yup, thats exactly why. I am currently only working on one sheet of a huge file with multiple sheets and the particular sheet I am working on needs to be sent to management for my job. They've requested that we copy the completed tables to a word document before sending to them. I just need word to be opened with that copied table in landscape for convience on their end is all I am trying to do.

  4. #4
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    139

    Re: Copied excel table to Word, but Word opening in landscape

    I didn't understand that last part until now, thanks. I'll suggest that they view it that way instead of in word, or I'll just change it each time before sending to them like I figured I had to do. I have seen excel VBA code through research that does this, I just don't know how to incorporate it within my current code.

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

    Re: Copied excel table to Word, but need Word opening in landscape

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

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    Hello jennis7242,

    The Code posted by macropod works flawlessly, but in VBE you will first have to enable MicrosoftWord ("Some Number") Object Library. In Office 2010 it is MicrosoftWord 14.0 Object Library.

    HTH

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

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

    Re: Copied excel table to Word, but need Word opening in landscape

    Quote Originally Posted by Winon View Post
    The Code posted by macropod works flawlessly, but in VBE you will first have to enable MicrosoftWord ("Some Number") Object Library.
    Given that jennis7242 already had:
    Dim AppWord As Word.Application
    it seemed self-evident the reference had already been set.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    @ macropod,

    That was exactly what I assumed as well, until I tested his and your Code. His Copy does Paste to Word, but only in Portrait. Your Code also erred with a message "Variable not defined". After I selected the Microsoftword Object Library, did your Code work as well, setting Word to Landscape. It will not work otherwise.

    Regards.

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

    Re: Copied excel table to Word, but need Word opening in landscape

    If you don't have a reference to Word, the code posted by jennis7242 will error-out with 'Compile error: User-defined type not defined'.

  10. #10
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    This is how I have tested the Code posted by jennis7242;

    Please Login or Register  to view this content.
    If you test it, it only Pastes to Word in Portrait. Your Code does also not work without my instructions as posted in Post# 6.

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

    Re: Copied excel table to Word, but need Word opening in landscape

    As you post clearly shows, you changed the code by commenting-out As Word.Application. That is not how jennis7242 posted it...

    If you're going to 'correct' me, you might at least test the code as posted.

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    I am not fighting with you macropod,

    If you're going to 'correct' me, you might at least test the code as posted.
    and that is exactly what I did, but your Code erred with a message saying, 'Compile error: User-defined type not defined'. Only when I selected the Microsoftword Object Library, did your Code work, setting Word to Landscape without any other issues. Please understand that it is not me trying to correct you, but rather sharing what I found happening on my System, which is running Windows 7 Professional with Office 2010. Hence my recommendation as mentioned in Post# 6.

    Your Comment as per Post# 7,

    Given that jennis7242 already had:
    Dim AppWord As Word.Application
    it seemed self-evident the reference had already been set.
    proved not to be so, as his Code, with me commenting out -'As Word.Application, did copy to Word, but only in Portrait, without me having had to select the Microsoftword Object Library at all.

    Regards.

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

    Re: Copied excel table to Word, but need Word opening in landscape

    Quote Originally Posted by Winon View Post
    Your Comment as per Post# 7,
    Quote Originally Posted by macropod View Post
    Given that jennis7242 already had:
    Dim AppWord As Word.Application
    it seemed self-evident the reference had already been set.
    proved not to be so, as his Code, with me commenting out -'As Word.Application, did copy to Word, but only in Portrait, without me having had to select the Microsoftword Object Library at all.
    Rubbish, is all I can say. Try starting Excel again and running the code as posted by jennis7242, without a Word library reference.

  14. #14
    Forum Contributor
    Join Date
    08-10-2017
    Location
    Lansing, Michigan
    MS-Off Ver
    2016
    Posts
    139

    Re: Copied excel table to Word, but need Word opening in landscape

    Thank you both for the replies and the entertainment haha. Macropod, it works perfect, thank you!

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    Rubbish, is all I can say. Try starting Excel again and running the code as posted by jennis7242, without a Word library reference.
    Before you make such a statement, please disable Word library reference on your system and test the attachment with my commenting out 'As Word.Application, then we'll see who is talking "Rubbish"!

    Also regard this as my last comment to you on this Thread.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    02-22-2016
    Location
    Harare, Zimbabwe
    MS-Off Ver
    2007 & 2010
    Posts
    65

    Re: Copied excel table to Word, but need Word opening in landscape

    Thank you for the sample Winon. Nice to learn new stuff.

    Cheers
    Happy? Click the * to the left.

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

    Re: Copied excel table to Word, but need Word opening in landscape

    Quote Originally Posted by Winon View Post
    Before you make such a statement, please disable Word library reference on your system and test the attachment with my commenting out 'As Word.Application, then we'll see who is talking "Rubbish"!
    The rubbish is the implication in your post #12 that not commenting out that line and not having a Word reference doesn't produce an error...

  18. #18
    Registered User
    Join Date
    02-22-2016
    Location
    Harare, Zimbabwe
    MS-Off Ver
    2007 & 2010
    Posts
    65

    Re: Copied excel table to Word, but need Word opening in landscape

    The rubbish is the implication in your post #12 that not commenting out that line and not having a Word reference doesn't produce an error...
    Rubbish! Winon did not say what you accuse him of in Post 12.

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

    Re: Copied excel table to Word, but need Word opening in landscape

    I suggest you read the whole thread, not just post #12 in isolation.

  20. #20
    Registered User
    Join Date
    02-22-2016
    Location
    Harare, Zimbabwe
    MS-Off Ver
    2007 & 2010
    Posts
    65

    Re: Copied excel table to Word, but need Word opening in landscape

    You isolated Post 12, quoting Winon incorrectly. That is Rubbish!

    You also quite comfortably choose to ignore his Post with a sample Workbook and instructions, which clearly shows your ignorance. I have tested it and it does exactly what he says. No wonder Winon is ignoring your selective self justification rubbish! Just try to be fair, and test Post 15, and be big enough to admit that Winon did prove you wrong.

  21. #21
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,077

    Re: Copied excel table to Word, but need Word opening in landscape

    @ myou,

    Hi myou, thank you for your interest in this Thread but, as a favour, just let it be. I believe that anyone who reads this complete thread will draw their own conclusions based on my sample Workbook.

    Just let it go please.

    macropod has contradicted himself many a time, and is now groping with feeble excuses to escape embarrassment.

    Regards.

+ 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. Extract Word header table data to excel (closed word document)
    By Yakov on Excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2017, 02:12 PM
  2. Deleting/removing content on Word table using Excel VBA (not Word VBA)
    By frankyuen1028 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-10-2016, 06:28 AM
  3. [SOLVED] Paste Excel object into Word document in landscape?
    By zijin_cheng in forum Excel General
    Replies: 4
    Last Post: 12-10-2014, 07:30 PM
  4. Convert Word to Excel based upon Word Table of Contents
    By jcappuccino7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2013, 01:25 PM
  5. Replies: 7
    Last Post: 04-21-2009, 02:50 AM
  6. [SOLVED] Copied range from excel to word (but not in table-form)
    By empyreum@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2006, 09:15 AM
  7. Replies: 4
    Last Post: 02-06-2006, 05:00 AM

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