Results 1 to 3 of 3
  1. #1
    bburton12@comcast.net is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    11

    Can VBA automatically copy a row in Excel and then close it?

    What I'm trying to do is copy a row from an Access table and paste it into Google Sheets.
    What I would normally have to do is manually enter information into each cell in Google Sheets.


    I was able to create an access program using mostly VBA and forms that would allow me to enter the information into textboxes on my form. Then I would click a button and it would output that information into a row in Microsoft Excel with specific formatting. Then I would copy the row in Excel and paste it into Google Sheets.




    My program does work and saves a lot of time, but I'd like to make it more efficient if possible. As long as Access is running, is there a way for it to copy the Excel row and close it automatically so I don't have to manually select the row, copy it, and then close Excel? Then, when I click the button, the only thing I would manually need to do is paste into the Google Sheet. I would need to keep the formatting from excel. This would be much for convenient than having to do the copy and pasting and closing Excel myself since I have to this often.

    Also, I'm using Access 2016.

    Thanks,
    Brad

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    VBA can certainly select row, copy, paste, and close Excel.

    This question that needs answer is: Can the clipboard retain the Excel row data if Excel is closed?

    Do a test with code that selects and copies then closes that Excel workbook. Are you still able to paste the row from clipboard?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bburton12@comcast.net is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    11
    Quote Originally Posted by June7 View Post
    VBA can certainly select row, copy, paste, and close Excel.

    This question that needs answer is: Can the clipboard retain the Excel row data if Excel is closed?

    Do a test with code that selects and copies then closes that Excel workbook. Are you still able to paste the row from clipboard?

    OK. It works. It did stay on the clipboard after copying the row. Thanks for breaking it down.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automatically copy / paste To, CC, Subject. Body message to outlook
    By msixpackabs in forum Import/Export Data
    Replies: 4
    Last Post: 06-22-2016, 03:09 PM
  2. Replies: 2
    Last Post: 09-23-2015, 09:02 PM
  3. Replies: 6
    Last Post: 10-03-2012, 05:50 AM
  4. Automatically close form in 5 seconds
    By alaric01 in forum Forms
    Replies: 4
    Last Post: 09-21-2010, 04:25 AM
  5. VBA to open excel, import on close of excel
    By bdaniel in forum Programming
    Replies: 0
    Last Post: 03-20-2010, 02:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums