Warning when overrides PDF

Hatye

Board Regular
Joined
Jan 11, 2010
Messages
143
Hi,

I have the following code for saving as PDF:

Code:
Private Sub LagrePDF_Click()


Application.DisplayAlerts = True


If Sheets("Lister").Range("BQ3").Value = "x" Then
    If Sheets("Rapport").Range("AE6").Value = "" Then
        Call PdfGnrBnr
        Else: Call PdfGnrBnrFnr
    End If
Else:


Dim fileSaveName As Variant


    wbName = Split(ActiveWorkbook.Name, ".")(0)


    fileSaveName = Application.GetSaveAsFilename(initialFilename:=wbName)
    If VarType(fileSaveName) = vbBoolean Then Exit Sub
    
    fileSaveName = Left(fileSaveName, Len(fileSaveName) - 1)
    
    'Hvis Gemini Terreng & Entprenrenør
        If Rows("63:63").Hidden = True Then
            Dim varMyArray() As Variant 'Declares a dynamic array variable
            Dim lngArrayCount As Long
            Dim varMySheet As Variant
                
            For Each varMySheet In Array("Rapport", "Rapport_Linjer", "Rapport_Punkt", "Rapport_Polygon", "Rapport_Tekst", "Rapport_Triangelnett")
                If Len(Sheets(varMySheet).Range("A7")) > 0 Or varMySheet = "Rapport" Then
                    lngArrayCount = lngArrayCount + 1
                    ReDim Preserve varMyArray(1 To lngArrayCount) 'Append the record to the existing array
                    varMyArray(lngArrayCount) = varMySheet
                End If
            Next varMySheet
            
            Sheets(varMyArray).Select
        End If
    
    ' Save as PDF
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, fileName:=fileSaveName, _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, OpenAfterPublish:=True
    
End If


Me.Hide
        
End Sub

But it doesn't warn me when it overrides an existing PDF, even though I have
Code:
Application.DisplayAlerts = True
at the beginning.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,837
Messages
6,121,883
Members
449,057
Latest member
Moo4247

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top