ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help... (https://www.excelbanter.com/excel-programming/339291-macro-help.html)

miwarren

Macro help...
 

I am running a macro that prompts asking if you would like to keep the
data on the clipboard. The answer always needs to be yes and I was
wondering is there code I can add to my macro that will automatically
answer this question yes instead of prompting the user for the answer?

Thanks for your help.


--
miwarren
------------------------------------------------------------------------
miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
View this thread: http://www.excelforum.com/showthread...hreadid=437380


davidm

Macro help...
 

Comment out the line(s) of code that triggers off the message.


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=437380


miwarren[_2_]

Macro help...
 

davidm Wrote:
Comment out the line(s) of code that triggers off the message.


I don't have a code to trigger the prompt. Below is the code where the
prompt takes place.

Workbooks.Open Filename:="I:\SECURED\B&H Reconciliations\" &
Range("K5").Value & ".xls"
Selection.Copy
ActiveWindow.Close
Sheets("Submit").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False

After the activewindow.close it then issues the prompt.

Thanks for the advice!

More help needed please...


--
miwarren
------------------------------------------------------------------------
miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
View this thread: http://www.excelforum.com/showthread...hreadid=437380


davidm

Macro help...
 

After Selection.copy, insert

Application.DisplayAlerts=False


and before *End Sub*, close off with
Application.DisplayAlerts=True

-------------------------------------------------------------------------------
Workbooks.Open Filename:="I:\SECURED\B&H Reconciliations\"
Range("K5").Value & ".xls"
APPLICATION.DISPLAYALERTS=FALS
Selection.Copy
ActiveWindow.Close
Sheets("Submit").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False

...... ....... ........
...... ....... .........

APPLICATION.DISPLAYALERTS=TRU
End Su

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=43738


miwarren[_3_]

Macro help...
 

Thanks so much!!!


--
miwarren
------------------------------------------------------------------------
miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
View this thread: http://www.excelforum.com/showthread...hreadid=437380


Hoshyar

Macro help...
 
Hi Davidm,

I have the same problem, but as I am not a programmer, I couldn't understand
your answer here. would you kindly explain what shall I do to stop the code
that triggers this message?

Thanks in advance
Hoshyar

"davidm" wrote:


Comment out the line(s) of code that triggers off the message.


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=437380



miwarren[_4_]

Macro help...
 

Hoshyar Wrote:
Hi Davidm,

I have the same problem, but as I am not a programmer, I couldn'
understand
your answer here. would you kindly explain what shall I do to stop th
code
that triggers this message?

Thanks in advance
Hoshyar



Hello Hoshyar,

Here is how I corrected the problem. You will need to find the cod
listed below:

ACTIVEWINDOW.CLOS

Then surround it by these two tags:

APPLICATION.DISPLAYALERTS=FALSE

APPLICATION.DISPLAYALERTS=TRU

So it should look like this:

APPLICATION.DISPLAYALERTS=FALSE
ACTIVEWINDOW.CLOSE
APPLICATION.DISPLAYALERTS=TRU

I hope this helps... It did for me

--
miwarre
-----------------------------------------------------------------------
miwarren's Profile: http://www.excelforum.com/member.php...fo&userid=2468
View this thread: http://www.excelforum.com/showthread.php?threadid=43738



All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com