+ Reply to Thread
Results 1 to 17 of 17

Pasting to Word Document

  1. #1
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Pasting to Word Document

    Hello -

    I ran into an issue with the below - basically the goal is to copy whats on the sheet
    and paste into a word document (need to keep the same formatting and to paste NOT as a table)
    and fix the spacing before and after to be 0.
    What its doing now is pasting in the Word document as a table and the spacing options
    are not working for me. I tried pasting as Plain text but lost the
    boldness I had already. Any help would be appreciated.

    Please Login or Register  to view this content.
    Thank you !

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    Quote Originally Posted by twckfa16 View Post
    need to keep the same formatting and to paste NOT as a table
    Can you explain what you mean by this? Excel ranges are pasted into Word as tables. The only other options are:

    Paste as plain text
    Paste as an Excel object
    Paste as a picture

    Can you provide a Word file that shows what result you want?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    Hello - thank you for answering!

    I will attach a couple of files....the desired result photo may have to be zoomed in on...basically what what is in the photo minus the grid. Bear in mind, the photo is how
    it looks in my phone. I need the lines that are bold to stay bold etc.

    Thank you -

    Mark

    ps - may have to attach files again = hope this works
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    The Word file you attached does have a table. The table has no borders. Is that what you want? This removes the borders:

    Please Login or Register  to view this content.


    The other option is to paste then convert the table to text.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    Hi 6 string - I am trying what you suggested but not sure if I am making a mistake with it. Here is the code I have:

    Please Login or Register  to view this content.
    Commented out was your second suggestion - again maybe I'm doing it incorrectly.

    I attached what was generated from the code above and a sample word document of the desired result.

    Thank you for your help!

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    Maybe give us the Excel file so we can run the code.

  7. #7
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    That makes sense - I will get the file together (will taylor to make
    It simple )

    Thank you !

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    You have to remove the borders after the paste.

    This worked for me. It creates a table, but there are no borders. You seem to care just about not showing the gridlines.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    Thank you ! Wil try out later today and let you know
    how I made out.

  10. #10
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    Hi 6String -

    Apologies for the delay - I copied your code verbatim and ran it. This is what I got. I'm not sure
    what is going on. I'll attach all 3 files - also took a pic of what it looked like
    when opening from my phone. I'll keep at it

    Thanks!
    Attached Images Attached Images
    Attached Files Attached Files

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    Here's my test version.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    I ran your twckfa16 file and sent it to my phone - and I did a Word doc by just typing manually.
    I think it just might be the way Excel is copied into Word. Attached are snapshots
    of both

    Thanks!
    Attached Images Attached Images

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,461

    Re: Pasting to Word Document

    I don't believe that you are still using Excel 2007 if you are using it on your phone - please update your forum profile to whatever you are currently using. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  14. #14
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    Quote Originally Posted by twckfa16 View Post
    I ran your twckfa16 file and sent it to my phone
    What device are you running the code on? What does the resulting Word file look like on the same device where you run the code? How are you sending it to your phone, and how are you viewing it on your phone?

  15. #15
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2016
    Posts
    182

    Re: Pasting to Word Document

    Hi all - sorry this one got away from me for a few days

    AliGW - I updated my profile to Excel 2016

    6string - its OK the way it is - just trying out how to get rid of the grid - if it isnt possible its OK

    What device are you running the code on? Running it on my laptop which has Excel 2016
    What does the resulting Word file look like on the same device where you run the code?

    It looks like the file you sent me (may be attached here - ef_1

    How are you sending it to your phone - sending to my phone using this code

    Please Login or Register  to view this content.
    How are you viewing it on your phone? - I am viewing the file in the Files folder on my phone


    Thanks !

    Mark
    Attached Images Attached Images

  16. #16
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    The grid is there in Word because it's a table, but no visible gridlines. You won't see the gridlines if you are viewing it in Word, or if you print it.

    So you are emailing it to your phone as an attachment. (strFile does not seem to be defined.)

    I don't know what "in the Files folder on my phone" means. I was wondering what app you are using. If you are not using Word, and instead some other viewer, it may show the gridlines that Word does not show.

    It should be possible to add code to convert the table to text without losing formatting. I'll take a look when time permits.

  17. #17
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,783

    Re: Pasting to Word Document

    This will convert a table to text while preserving the formatting

    Please Login or Register  to view this content.

+ 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: 5
    Last Post: 10-10-2021, 11:49 PM
  2. [SOLVED] Text format when pasting a table from word document
    By Goodstart14 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2016, 12:29 AM
  3. [SOLVED] Multiple pasting to a new Word document using vba
    By Minoli in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2016, 05:59 PM
  4. Pasting data into an existing Word Document Table
    By steeladept in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 04:58 PM
  5. Add text to Existing Word Document if it Doesn't exist create Word Document
    By unstable81 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2013, 12:15 AM
  6. Copying Cell data and pasting into word document?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-07-2006, 05:41 AM
  7. [SOLVED] VB automated pasting of Excel range into Word document
    By ardvk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2005, 03:06 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