Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Application.DisplayAlerts = False - Not Working

1) In the code below I am trying to open an excel file, convert it
into pdf, and close the excel file. When I run this macro I keep
getting prompted to replace the current pdf file and I want to
overwrite that as the pdf file needs to be replaced everyday. The
Application.DisplayAlerts are not doing anything. Any suggestions to
stop this prompt?

2) Also, I would like to save the pdf without going through the save as
prompt. Initially, I had a code that would open the excel file and just
save it as pdf in a predetermined folder. But when I would go to open
the pdf file I would get an error from adobe saying that the file
format was incorrect. Any ideas?

Any help is greatly appreciated. Thank you in advance.

This is the code I am using now:

ChDir "C:\Documents and Settings\43202328\Desktop\PDF
Ratesheets\InternetRates\"
Workbooks.Open Filename:="C:\Documents and
Settings\43202328\Desktop\PDF Ratesheets\InternetRates\CABROK.XLS"


On Error Resume Next
For i = 1 To 9
Application.ActivePrinter = "Adobe PDF on Ne0" & i & ":"
If Err.Number = 0 Then Exit For
Err.Clear
Next

Application.ActivePrinter = "Adobe PDF on Ne0" & i & ":"
Windows("CABROK.xls").Activate
Application.DisplayAlerts = False
ActiveWorkbook.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne0" & i & ":", Collate:=True
Windows("CABROK.xls").Activate
Application.DisplayAlerts = True
ActiveWindow.Close


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Application.DisplayAlerts = False - Not Working

For the first issue you might try using the Kill function to delete the file
just before you recreate it.

--
Jim
wrote in message
oups.com...
| 1) In the code below I am trying to open an excel file, convert it
| into pdf, and close the excel file. When I run this macro I keep
| getting prompted to replace the current pdf file and I want to
| overwrite that as the pdf file needs to be replaced everyday. The
| Application.DisplayAlerts are not doing anything. Any suggestions to
| stop this prompt?
|
| 2) Also, I would like to save the pdf without going through the save as
| prompt. Initially, I had a code that would open the excel file and just
| save it as pdf in a predetermined folder. But when I would go to open
| the pdf file I would get an error from adobe saying that the file
| format was incorrect. Any ideas?
|
| Any help is greatly appreciated. Thank you in advance.
|
| This is the code I am using now:
|
| ChDir "C:\Documents and Settings\43202328\Desktop\PDF
| Ratesheets\InternetRates\"
| Workbooks.Open Filename:="C:\Documents and
| Settings\43202328\Desktop\PDF Ratesheets\InternetRates\CABROK.XLS"
|
|
| On Error Resume Next
| For i = 1 To 9
| Application.ActivePrinter = "Adobe PDF on Ne0" & i & ":"
| If Err.Number = 0 Then Exit For
| Err.Clear
| Next
|
| Application.ActivePrinter = "Adobe PDF on Ne0" & i & ":"
| Windows("CABROK.xls").Activate
| Application.DisplayAlerts = False
| ActiveWorkbook.PrintOut Copies:=1, ActivePrinter:= _
| "Adobe PDF on Ne0" & i & ":", Collate:=True
| Windows("CABROK.xls").Activate
| Application.DisplayAlerts = True
| ActiveWindow.Close
|
|
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Application.DisplayAlerts = False - Not Working

Jim,

Thanks- That works great.

The thing I cant figure out now is how to close the acrobat window
after the pdf is created. I cant seem to find a code for that. Any
ideas?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Application.DisplayAlerts = False - Not Working

There is nothing in Excel for closing another application. It probably can
be done through a Windows API call but I don't have example code.

--
Jim
wrote in message
oups.com...
| Jim,
|
| Thanks- That works great.
|
| The thing I cant figure out now is how to close the acrobat window
| after the pdf is created. I cant seem to find a code for that. Any
| ideas?
|


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
DisplayAlerts = false not working Mark Stephens Excel Programming 4 June 13th 05 06:05 AM
Application.EnableEvents = False not working Paul Martin Excel Programming 3 May 10th 05 05:06 AM
Application.Displayalerts = value (is not working for me) [email protected] Excel Programming 3 December 18th 04 02:00 AM
application.displayalerts is not working will lam Excel Programming 2 April 30th 04 08:21 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 03:13 AM.

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

About Us

"It's about Microsoft Excel"