+ Reply to Thread
Results 1 to 6 of 6

Select All & Copy Cell Contents in Edit Mode using VBA

  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    4

    Select All & Copy Cell Contents in Edit Mode using VBA

    Hi, I'm new to the forum and not an advanced excel user.

    I'm trying to use SendKeys to select all the contents of the active cell copy and paste to Notepad. The reason I want to use SendKeys is so that the cell is in edit mode to keep the formatting I've entered after pasting into Notepad or Word.

    Here's what I'm trying but I'm missing the select all & copy step:

    Range("A1").Value = ActiveCell.Value
    Range("A1").Select
    SendKeys "F2"
    <<Select ALL & COPY>>
    Shell "notepad.exe", vbNormalFocus
    SendKeys "^V"

    I have basic-midlevel knowledge of programming so I can cut and paste things together in VB, but a little help would be appreciated!

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Select All & Copy Cell Contents in Edit Mode using VBA

    Instead of calling a notepad and pasting the value Just paste it in a new sheet and save that sheet as notepad file.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-24-2013
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Select All & Copy Cell Contents in Edit Mode using VBA

    Well, part of the reason I wanted to paste to Notepad is because I need to copy the text to another program with formatting similar to Notepad. I need all the line breaks to appear. So I don't necessarily want to create a new document. I guess ideally I would like to leave out the process of creating a txt file.
    Last edited by salsura; 04-24-2013 at 10:17 AM.

  4. #4
    Registered User
    Join Date
    04-24-2013
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Select All & Copy Cell Contents in Edit Mode using VBA

    Well, part of the reason I wanted to paste to Notepad is because I need to copy the text to another program with formatting similar to Notepad. I need all the line breaks to appear. So I don't necessarily want to create a new document. I guess ideally I would like to leave out the process of creating a txt file.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Select All & Copy Cell Contents in Edit Mode using VBA

    1. notepad doesn't keep formatting
    2. you can't run code in edit mode
    sorry ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    04-24-2013
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Select All & Copy Cell Contents in Edit Mode using VBA

    I thought perhaps there might be another route, oh well. Thanks anyway!

    Sorry for replying twice, I was trying to delete the duplicate post, but I guess that's not an option.

+ 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