Disable clipboard prompt in Excel VBA on workbook close -


i have excel workbook, using vba code opens workbook, copies data original, closes second workbook.

when close second workbook (using application.close), prompt for:

do want save clipboard.

is there command in vba bypass prompt?

i can offer 2 options

  1. direct copy

based on description i'm guessing doing

set wb2 = application.workbooks.open("yourfile.xls") wb2.sheets("yoursheet").[<yourrange>].copy thisworkbook.sheets("somesheet").paste wb2.close 

if case, don't need copy via clipboard. method copies source destination directly. no data in clipboard = no prompt

set wb2 = application.workbooks.open("yourfile.xls") wb2.sheets("yoursheet").[<yourrange>].copy thisworkbook.sheets("somesheet").cells(<yourcell") wb2.close 
  1. suppress prompt

you can prevent alert pop-ups setting

application.displayalerts = false 

[edit]

  1. to copy values only: don't use copy/paste @ all

dim rsrc range dim rdst range set rsrc = wb2.sheets("yoursheet").range("yourrange") set rdst = thisworkbook.sheets("somesheet").cells("yourcell").resize(rsrc.rows.count, rsrc.columns.count) rdst = rsrc.value 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -