Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Private Sub Excel_File_Maken() ' revisie [24-01-2025] maakt een extra WerkBlad aan
Dim c01 As String, MJOBJaar As Integer, i As Integer
Application.DisplayAlerts = False
Worksheets("Blad1").Activate ' activeert wb DBase cel A1
With Worksheets("Blad1")
If PrintType = "PDFIndividueel" Then ' But2 één bepaalde pagina printen
If PDFKleurOfCheckBox = True Then MsgBox ("PDF = 0"): .Range("G1") = 0 ' doorgeven PDFKleurCheckBox voor nwe file
If PDFKleurOnCheckBox = True Then MsgBox ("PDF = 1"): .Range("G1") = 1 ' doorgeven PDFKleurCheckBox voor nwe file
ActiveWorkbook.Worksheets("Blad1").Range("A1").Select ' zet active cel op A1
If Pagina = 1 Then .Range("A1:H42").Select: SelRange = "A1:H42" ' SelRange = selectie
If Pagina = 2 Then .Range("A43:H83").Select: SelRange = "A43:H83" ' SelRange = selectie
If Pagina = 3 Then .Range("A84:H94").Select: SelRange = "A84:H94" ' SelRange = selectie
If PrintPDFType = 2 Then
If Pagina = 1 Then c01 = ActiveWorkbook.Worksheets("Control").Range("D6") & ActiveWorkbook.Worksheets("Control").Range("D10") & "PDFPag1" & ".xls" ' Path en Naam + Pag1 + extensie
If Pagina = 2 Then c01 = ActiveWorkbook.Worksheets("Control").Range("D6") & ActiveWorkbook.Worksheets("Control").Range("D10") & "PDFPag2" & ".xls" ' Path en Naam + Pag1 + extensie
If Pagina = 3 Then c01 = ActiveWorkbook.Worksheets("Control").Range("D6") & ActiveWorkbook.Worksheets("Control").Range("D10") & "PDFPag3" & ".xls" ' Path en Naam + Pag1 + extensie
End If
End If
If PrintType = "PDFAll" Then ' But3 Alle (3) pagina's printen
If PDFKleurOfCheckBox = True Then MsgBox ("PDF = 0"): .Range("G1") = 0 ' doorgeven PDFKleurCheckBox voor nwe file
If PDFKleurOnCheckBox = True Then MsgBox ("PDF = 1"): .Range("G1") = 1 ' doorgeven PDFKleurCheckBox voor nwe file
.Range("A1:H94").Select: SelRange = "A1:H94" ' SelRange = selectie
c01 = ActiveWorkbook.Worksheets("Control").Range("D6") & ActiveWorkbook.Worksheets("Control").Range("D10") & "PDFAll" & ".xls" ' Path en Naam + Pag1 + extensie
End If
.Range(SelRange).Copy
End With
With ActiveWorkbook.Sheets.Add ' maakt een nieuw wb aan
If PrintType = "PDFIndividueel" Then ' But2 één bepaalde pagina printen
If PDFKleurOfCheckBox = True Then ' zwart-wit
.Range("A1").PasteSpecial Paste:=xlPasteValues ' https://www.thespreadsheetguru.com/the-code-vault/best-way-to-copy-pastespecial-values-only-with-vba
.Range("A1").PasteSpecial xlPasteFormats ' https://wellsr.com/vba/2018/excel/vba-pastespecial-values-formats-formulas-and-more/
End If
If PDFKleurOnCheckBox = True Then
.Range("A1").PasteSpecial Paste:=xlPasteAll ' kleur
End If
End If
If PrintType = "PDFAll" Then ' But2 Alle (3) pagina's printen
If PDFKleurOfCheckBox = True Then ' zwart-wit
.Range("A1").PasteSpecial Paste:=xlPasteValues ' https://www.thespreadsheetguru.com/the-code-vault/best-way-to-copy-pastespecial-values-only-with-vba
.Range("A1").PasteSpecial xlPasteFormats ' https://wellsr.com/vba/2018/excel/vba-pastespecial-values-formats-formulas-and-more/
End If
If PDFKleurOnCheckBox = True Then
.Range("A1").PasteSpecial Paste:=xlPasteAll ' kleur
End If
End If
Application.CutCopyMode = False ' maakt klembord leeg
' .Columns.AutoFit ' past de kolommen aan, aan de nodige breedte
.Columns("A").ColumnWidth = 4 ' kolom A in nwe file
.Columns("B").ColumnWidth = 12 ' kolom B in nwe file
.Columns("C").ColumnWidth = 20 ' kolom C in nwe file
.Columns("D").ColumnWidth = 10 ' kolom D in nwe file
.Columns("E").ColumnWidth = 12.67 ' kolom E in nwe file
.Columns("F").ColumnWidth = 22.22 ' kolom F in nwe file
.Columns("G").ColumnWidth = 6.11 ' kolom G in nwe file
.Columns("H").ColumnWidth = 52.89 ' kolom H in nwe file
.Copy ' maakt een kopie van dit nieuwe wb
With ActiveWorkbook ' met nieuwe wb
With ActiveSheet.PageSetup ' zet de juiste marges neer voor nieuwe file
.Orientation = xlLandscape ' https://www.ozgrid.com/forum/forum/help-forums/excel-general/139429-pagesetup-and-papersize-macro
.PaperSize = xlPaperA4
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.2)
.BottomMargin = Application.InchesToPoints(0.2)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
End With
.SaveCopyAs c01 ' met nieuwe wb, slaat op als file
.Close ' met nieuwe wb, sluit dit nieuw file, belangrijk omdat onder Check Excel Bestaat
End With ' een Path moet worden ingelezen van wb Control.Range("D6")!
.Delete ' met nieuwe wb, deze verwijderen
End With
End Sub
Sub KopieerBladZonderKleur()
Sheets("Blad1").Copy
With Cells
.Interior.Pattern = xlNone
.Font.ColorIndex = xlAutomatic
End With
End Sub
Function BestaatBestand(filenaam) As Boolean
If Dir(filenaam) <> "" Then BestaatBestand = True
End Function
Sub test()
filenaam = ThisWorkbook.FullName
If BestaatBestand(filenaam) Then
MsgBox "Bestand " & filenaam & " bestaat."
Else
MsgBox "Bestand " & filenaam & " niet gevonden."
End If
filenaam = "DitBestandBestaatVastNiet"
If BestaatBestand(filenaam) Then
MsgBox "Bestand " & filenaam & " bestaat."
Else
MsgBox "Bestand " & filenaam & " niet gevonden."
End If
End Sub
Private Sub Workbook_Open()
With ActiveWindow
.WindowState = xlNormal
.Height = 500
.Width = 1000
End With
End Sub
Dim Path As String
Path = ActiveWorkbook.Worksheets("Control").Range("D6")
Shell "C:\WINDOWS\explorer.exe """ & Path & "", vbNormalFocus
Shell.Height = 500
Shell.Width = 1000
Private Sub MapExcelBut_Click()
Dim Path As String
Path = ActiveWorkbook.Worksheets("Control").Range("D6")
Shell "C:\WINDOWS\explorer.exe """ & Path & "", vbNormalFocus
With ActiveWindow
.WindowState = xlNormal
.Shell.Height = 500
.Shell.Width = 1000
End With
End Sub
' Shell "C:\WINDOWS\explorer.exe """ & Path & "", vbNormalFocus
Shell Path
' With ActiveWindow
With Shell
' .WindowState = xlNormal
' .Shell.Height = 500
' .Shell.Width = 1000
' .Top = 100
' .Left = 10
.Height = 10 'Application.UsableHeight
.Width = 10 'Application.UsableWidth
End With
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.