Suppress warning when Merging Cells by Code

  • Thread starter Thread starter Ashish
  • Start date Start date
A

Ashish

Hello,



While writing in Excel through Code I have also merged the cells.



_objRange = _objWorkSheet.Range(_objWorkSheet.Cells(_intCurrentRow,
17), _objWorkSheet.Cells(_intCurrentRow, 18))

_objRange.Merge()

_objRange.Value = intTotalTax



But, when I merge the cells from code then too a warning is shown to user on
UI $B!H(BMerging Cell will keep only contents of top left cell$B!I(B.

How can I suppress these warnings?

This is happening in Excel 2000 (10.0 Object Library) on WindowsXP.



Thanks and Regards,

Ashish
 
Hi
try
_objRange =
_objWorkSheet.Range(_objWorkSheet.Cells(_intCurrentRow,
17), _objWorkSheet.Cells(_intCurrentRow, 18))

application.displayalerts = false

_objRange.Merge()
application.displayalerts = true
_objRange.Value = intTotalTax
 
To turn off warnings

Application.DisplayAlerts = False


To turn on warnings

Application.DisplayAlerts = Tru
 
Back
Top