Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Displayalerts not working

Hi,

Im trying to open a non excel file ( Textpad kind of file) from excel and
then saving it as excel type file using the following code ( I made the code
by recording the macro).

I added DisplayAlerts statements at the appropriate places so that
overwriting could be done .

Inspite of the above if dev11112 already exists then I get a message saying
that "A file named '......' already exists in that location. Do you want to
replace it?

Is there something wrong/incorrect in my displayalerts statement?

Workbooks.OpenText Filename:= _
"C:\Documents and Settings\abc\Desktop\dev11112.lst", Origin:=437,
StartRow _
:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True

DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\abc\Desktop\dev11112.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

ActiveWorkbook.Close

DisplayAlerts = True

--
Thanks a lot,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Displayalerts not working

Hi Hari,

Try changing:


DisplayAlerts = False


to

Application. DisplayAlerts = False


---
Regards,
Norman



"Hari" wrote in message
...
Hi,

Im trying to open a non excel file ( Textpad kind of file) from excel and
then saving it as excel type file using the following code ( I made the
code
by recording the macro).

I added DisplayAlerts statements at the appropriate places so that
overwriting could be done .

Inspite of the above if dev11112 already exists then I get a message
saying
that "A file named '......' already exists in that location. Do you want
to
replace it?

Is there something wrong/incorrect in my displayalerts statement?

Workbooks.OpenText Filename:= _
"C:\Documents and Settings\abc\Desktop\dev11112.lst", Origin:=437,
StartRow _
:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True

DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\abc\Desktop\dev11112.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

ActiveWorkbook.Close

DisplayAlerts = True

--
Thanks a lot,
Hari
India




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Displayalerts not working

Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True


to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False


to

Application. DisplayAlerts = False


---
Regards,
Norman



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Displayalerts not working

Hi Norman,

Thanks a ton for your kind help.

Thanks again,
Hari
India


"Norman Jones" wrote in message
...
Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True


to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False


to

Application. DisplayAlerts = False


---
Regards,
Norman





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Displayalerts not working

Hi Norman,

Just from understanding point of view....

When I previously wrote it as -- DisplayAlerts = True -- how does excel
interpret the statement. Is NOT writing Application. NOT considered as an
error. Does that mean DisplayAlerts = True is also a valid statement on its
own and if so what does it do.

Thanks a lot,
Hari
India

"Norman Jones" wrote in message
...
Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True


to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False


to

Application. DisplayAlerts = False


---
Regards,
Norman







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Displayalerts not working

Hi Hari,

Try runnining this small demo:

Sub Tester()
Debug.Print "Opening State", Application.DisplayAlerts
DisplayAlerts = False
Debug.Print "After DisplayAlerts = False command", _
Application.DisplayAlerts

DisplayAlerts = True
Debug.Print "Closing State", Application.DisplayAlerts

End Sub

The immediate window reports:


Opening State True
After DisplayAlerts = False command True
Closing State True

As you see, if DisplayAlerts is used without the required Application
qualifier, no error is observed but neither is any response.

That is why Excel was throwing up the overwrite alert message. If you rerun
the code (using the qualified construct), no alert should be observed.

For the record, I have not run your code or otherwise examined it. I did,
however, run a test repoducing a file overwrite event.

---
Regards,
Norman



"Hari" wrote in message
...
Hi Norman,

Just from understanding point of view....

When I previously wrote it as -- DisplayAlerts = True -- how does excel
interpret the statement. Is NOT writing Application. NOT considered as an
error. Does that mean DisplayAlerts = True is also a valid statement on
its
own and if so what does it do.

Thanks a lot,
Hari
India

"Norman Jones" wrote in message
...
Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True


to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False

to

Application. DisplayAlerts = False


---
Regards,
Norman







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Displayalerts not working

Norman didn't talk about what displayalerts is.

Sub TesterAA()

Debug.Print "Opening State", Application.DisplayAlerts
DisplayAlerts = False
Debug.Print "After DisplayAlerts = False command", _
Application.DisplayAlerts
DisplayAlerts = "Funny Bunny"
Debug.Print "DisplayAlerts is a " & _
TypeName(DisplayAlerts) & " with a value of " & _
DisplayAlerts
DisplayAlerts = True
Debug.Print "Closing State", Application.DisplayAlerts

End Sub

produces:

Opening State True
After DisplayAlerts = False command True
DisplayAlerts is a String with a value of Funny Bunny
Closing State True

---------

so displayalerts = "anything" creates a new variant variable and assigns it
a value.

If you put

Option Explicit

at the top of the module and compile, you will be notified that
DisplayAlerts is undefined.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Hari,

Try runnining this small demo:

Sub Tester()
Debug.Print "Opening State", Application.DisplayAlerts
DisplayAlerts = False
Debug.Print "After DisplayAlerts = False command", _
Application.DisplayAlerts

DisplayAlerts = True
Debug.Print "Closing State", Application.DisplayAlerts

End Sub

The immediate window reports:


Opening State True
After DisplayAlerts = False command True
Closing State True

As you see, if DisplayAlerts is used without the required Application
qualifier, no error is observed but neither is any response.

That is why Excel was throwing up the overwrite alert message. If you

rerun
the code (using the qualified construct), no alert should be observed.

For the record, I have not run your code or otherwise examined it. I did,
however, run a test repoducing a file overwrite event.

---
Regards,
Norman



"Hari" wrote in message
...
Hi Norman,

Just from understanding point of view....

When I previously wrote it as -- DisplayAlerts = True -- how does excel
interpret the statement. Is NOT writing Application. NOT considered as

an
error. Does that mean DisplayAlerts = True is also a valid statement on
its
own and if so what does it do.

Thanks a lot,
Hari
India

"Norman Jones" wrote in message
...
Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True

to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False

to

Application. DisplayAlerts = False


---
Regards,
Norman









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
Application.Displayalerts = value (is not working for me) [email protected] Excel Programming 3 December 18th 04 02:00 AM
DisplayAlerts Intermittently stops working Daniel[_11_] Excel Programming 1 June 17th 04 09:32 AM
application.displayalerts is not working will lam Excel Programming 2 April 30th 04 08:21 PM
Can't Set DisplayAlerts to False Mark Driscol Excel Programming 1 April 6th 04 10:45 PM
Application::DisplayAlerts not working Howard Dierking Excel Programming 2 February 11th 04 12:04 PM


All times are GMT +1. The time now is 09:30 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"