PC Review


Reply
Thread Tools Rate Thread

Confirm save file

 
 
ernie
Guest
Posts: n/a
 
      9th Jan 2009
Hello to you all happy new year.

In my code below i dont get the security alert which tells me that i'm gonna
overwrite an existing file name. Can someone help me modify this code to
display the security alert.

Sub PrintToFile()
'This example publish the first two pages of the ActiveSheet
'You can change the from and To to only publish the pages you want
Dim FilenameStr As String

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then

FilenameStr =
Application.GetSaveAsFilename(FileFilter:="DecProFile(*.pdf), *.pdf",
InitialFileName:=Trim(Workbooks("Declaration
Pro.xls").Worksheets("Front").Range("B4").Value))
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilenameStr, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
From:=1, _
To:=Worksheets("front").Range("G6").Value, _
OpenAfterPublish:=False
MsgBox "You can find the PDF file here : " & FilenameStr
Else
MsgBox "PDF add-in Not Installed, Contact (E-Mail Removed)/2257778
for installation file"
End If
End Sub

Thanks in Advance
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      10th Jan 2009
Is it actually overwriting or is it putting the same file name with a
different file extension. If it is the latter, Excel sees the different file
extension as a completely different file and will not execute the error
message. If it is overwriting without issuing the warning, then there is a
problem somewhere.

"ernie" wrote:

> Hello to you all happy new year.
>
> In my code below i dont get the security alert which tells me that i'm gonna
> overwrite an existing file name. Can someone help me modify this code to
> display the security alert.
>
> Sub PrintToFile()
> 'This example publish the first two pages of the ActiveSheet
> 'You can change the from and To to only publish the pages you want
> Dim FilenameStr As String
>
> If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
> & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then
>
> FilenameStr =
> Application.GetSaveAsFilename(FileFilter:="DecProFile(*.pdf), *.pdf",
> InitialFileName:=Trim(Workbooks("Declaration
> Pro.xls").Worksheets("Front").Range("B4").Value))
> ActiveSheet.ExportAsFixedFormat _
> Type:=xlTypePDF, _
> Filename:=FilenameStr, _
> Quality:=xlQualityStandard, _
> IncludeDocProperties:=True, _
> IgnorePrintAreas:=False, _
> From:=1, _
> To:=Worksheets("front").Range("G6").Value, _
> OpenAfterPublish:=False
> MsgBox "You can find the PDF file here : " & FilenameStr
> Else
> MsgBox "PDF add-in Not Installed, Contact (E-Mail Removed)/2257778
> for installation file"
> End If
> End Sub
>
> Thanks in Advance

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopping the confirm popup on file save with same name =?Utf-8?B?Q2hhcnRzbWFsbQ==?= Microsoft Excel Programming 4 11th Aug 2007 11:38 PM
dont confirm save with yes/no/cancell =?Utf-8?B?cHN3YW5pZQ==?= Microsoft Excel Programming 2 18th Jun 2007 05:56 PM
no confirm message when performing a save as gio520 Windows XP Help 0 22nd Jul 2006 07:20 PM
After Save Event - Confirm Steph Microsoft Excel Programming 11 27th Oct 2005 09:43 PM
Confirm Save MsgBox =?Utf-8?B?U3R1Sm9s?= Microsoft Access Forms 1 7th Aug 2005 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 AM.