Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert a key function in VBA script


I need a function that is going to hit the "Y" key for me. When I run a
certain macro, it wants to send a file to a certain location to update
it and replace the old one. During this I have to hit the "Y" key to
say yes. I want to add something to the script so I dont have to do
this and then finally the script will be able to run on its own without
me.

Trevor


--
Bowes813
------------------------------------------------------------------------
Bowes813's Profile: http://www.excelforum.com/member.php...o&userid=23779
View this thread: http://www.excelforum.com/showthread...hreadid=374160

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert a key function in VBA script


Good evening Bowes13

Use this command at the start of your code:

Application.DisplayAlerts = False

and this at the end of your code:

Application.DisplayAlerts = True

This will force the macro to not ask you a question, but choose th
default option on your behalf (which would be OK - overwrite th
file).

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=37416

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert a key function in VBA script


What if my default is No

--
Bowes81
-----------------------------------------------------------------------
Bowes813's Profile: http://www.excelforum.com/member.php...fo&userid=2377
View this thread: http://www.excelforum.com/showthread.php?threadid=37416

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert a key function in VBA script


Hi Bowes813

What I said in my answer was correct, but I think perhaps I could have
explained it a little better. this command will set your default value
for the question to true and answer the question for you. Indeed, this
is what the Excel 2003 help file has to say about the DisplayAlerts
property:

"When using the SaveAs method for workbooks to overwrite an existing
file, the 'Overwrite' alert has a default of 'No', while the 'Yes'
response is selected by Excel when the DisplayAlerts property is set
equal to True."

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=374160

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to insert Row Jeremy Excel Discussion (Misc queries) 2 April 19th 10 02:39 PM
Need VBA script to auto-insert value upon row insert Phil Excel Worksheet Functions 4 May 6th 08 02:41 PM
Script to insert the next Friday Mark Langendoerfer Excel Programming 1 April 12th 05 09:57 PM
Script to insert the next Friday T Kirtley Excel Programming 0 April 12th 05 08:27 PM
insert excel vb script bt707[_6_] Excel Programming 1 October 18th 03 03:43 PM


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"