Hallo,
ik heb een excelformulier gemaakt dmv comboboxen en textvelden, als alle verplichte velden zijn gevuld, kunnen ze op de cmb drukken van aanvragen. van dit formulier wordt dan een pdf gemaakt en moeten ze dit op hun eigen map bewaren, daarna wordt dit document verstuurd via outlook naar 1 vast mailadres. dit gaat verder allemaal goed, en wil ik ook zo houden. maar dan moet ik de gegevens op een ander exceldocument overtypen en dat wil ik eigenlijk niet.
dus moet er eigenlijk iets voordat het document wordt omgezet naar een pdf de gegevens in de comboboxen en andere velden de gegevens 1 centraal document worden gestuurd.
volgens mij moet dat wel kunnen, maar voor mij??? is er iemand die me hiermee helpen kan?
de invoer formulieren hebben ze dan allemaal op "eigen"schijf staan. we werken allemaal wel op 1 server.
code blad 1
wie kan me helpen?
ik heb een excelformulier gemaakt dmv comboboxen en textvelden, als alle verplichte velden zijn gevuld, kunnen ze op de cmb drukken van aanvragen. van dit formulier wordt dan een pdf gemaakt en moeten ze dit op hun eigen map bewaren, daarna wordt dit document verstuurd via outlook naar 1 vast mailadres. dit gaat verder allemaal goed, en wil ik ook zo houden. maar dan moet ik de gegevens op een ander exceldocument overtypen en dat wil ik eigenlijk niet.
dus moet er eigenlijk iets voordat het document wordt omgezet naar een pdf de gegevens in de comboboxen en andere velden de gegevens 1 centraal document worden gestuurd.
volgens mij moet dat wel kunnen, maar voor mij??? is er iemand die me hiermee helpen kan?
de invoer formulieren hebben ze dan allemaal op "eigen"schijf staan. we werken allemaal wel op 1 server.
code blad 1
Code:
Private Sub Cmb_Verz_Click()
'controle of alle tekstvelden zijn gevuld, behalve textbox Notitie
If Me.Cob_Aanvrager.Text = "" Then
MsgBox ("eigen naam vermelden!.")
ElseIf Me.Txt_Adres.Text = "" Then
MsgBox ("Straat naam vullen a.u.b.")
ElseIf Me.Txt_Nr.Text = "" Then
MsgBox ("Huisnummer invullen a.u.b.")
ElseIf Me.Cob_Plaats.Text = "" Then
MsgBox ("Plaatsnaam vermelden a.u.b.")
ElseIf Me.Cob_Reden.Text = "" Then
MsgBox ("Waarom is deze invent. nodig?, maak de keuze bij Reden Aanvraag")
ElseIf Me.Cob_Reden.Text = "Mutatie" And Me.Txt_ddEI = "1-1-2014" Then
MsgBox ("EI dd vermelden! ")
ElseIf Me.Cob_Reden.Text = "Mutatie" And Me.Txt_Notitie = "" Then
MsgBox ("vul in het notitieveld in waar je evt. een asbest toepassing hebt gezien of wat de reden is voor deze aanvraag ")
ElseIf Me.Cob_Reden.Text = "Mutatie" And Me.Cob_Sleutel = "" Then
MsgBox ("Is er een sleutelkluisje aanwezig? ")
ElseIf Me.Cob_Reden.Text = "Renovatie" And Me.Txt_Bewoner = "" Then
MsgBox ("Naam van bewoner invullen! ")
ElseIf Me.Cob_Reden.Text = "Service verzoek" And Me.Txt_Bewoner = "" Then
MsgBox ("Naam van bewoner invullen! ")
ElseIf Me.Cob_Reden.Text = "Renovatie" And Me.Txt_Telnr = "" Then
MsgBox ("Mobiel of vast tel.nr vermelden!! ")
ElseIf Me.Cob_Reden.Text = "Service verzoek" And Me.Txt_Telnr = "" Then
MsgBox ("Mobiel of vast tel.nr vermelden!! ")
ElseIf Me.Cob_Besmetting.Text = "" Then
MsgBox ("Is er sprak van een mogelijke besmetting?.")
ElseIf Me.Cob_Reden.Text = "Calamiteit" And Me.Txt_Notitie = "" Then
MsgBox ("Bij Calamiteit goed omschrijven in Notitieveld wat de reden is, waar de besmetting zit!! ")
ElseIf Me.Txt_Internnr.Text = "" Then
MsgBox ("Vul het interne ordernummer in ( ZS05)?.")
Else
Call RDB_Worksheet_Or_Worksheets_To_PDF_And_Create_Mail
End If
End Sub
Private Sub Cob_Reden_Change()
If Me.Cob_Reden.Text = "Mutatie" Then
Txt_ddEI.Visible = True
Else
Txt_ddEI.Visible = False
End If
End Sub]
Module Create PDF
[Option Explicit
'Note: The macro's in this module call the functions in the "FunctionsModule"
'Be sure that you also copy the code from this module if you want to use it in your own workbook.
Sub RDB_Workbook_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = RDB_Create_PDF(ActiveWorkbook, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveWorkbook, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
'Call the function with the correct arguments
'Tip: You can also use Sheets("Sheet3") instead of ActiveSheet in the code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveSheet, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Selection_Range_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"ungroup the sheets and try the macro again"
Else
'Call the function with the correct arguments
'For a fixed range use this line
FileName = RDB_Create_PDF(Range("A10:I15"), "", True, True)
'For the selection use this line
'FileName = RDB_Create_PDF(Selection, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(Selection, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
End Sub
Sub RDB_Sheet_Level_Names_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = Create_PDF_Sheet_Level_Names("addtopdf", "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'Create_PDF_Sheet_Level_Names("addtopdf", _
' "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Option Explicit
'Note: The macro's in this module call the functions in the "FunctionsModule"
'Be sure that you also copy the code from this module if you want to use it in your own workbook.
Sub RDB_Workbook_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = RDB_Create_PDF(ActiveWorkbook, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveWorkbook, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
'Call the function with the correct arguments
'Tip: You can also use Sheets("Sheet3") instead of ActiveSheet in the code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveSheet, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Selection_Range_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"ungroup the sheets and try the macro again"
Else
'Call the function with the correct arguments
'For a fixed range use this line
FileName = RDB_Create_PDF(Range("A10:I15"), "", True, True)
'For the selection use this line
'FileName = RDB_Create_PDF(Selection, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(Selection, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
End Sub
Sub RDB_Sheet_Level_Names_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = Create_PDF_Sheet_Level_Names("addtopdf", "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'Create_PDF_Sheet_Level_Names("addtopdf", _
' "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub]
Module Functionsmodule
[Option Explicit
'Note: The macro's in this module call the functions in the "FunctionsModule"
'Be sure that you also copy the code from this module if you want to use it in your own workbook.
Sub RDB_Workbook_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = RDB_Create_PDF(ActiveWorkbook, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveWorkbook, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
'Call the function with the correct arguments
'Tip: You can also use Sheets("Sheet3") instead of ActiveSheet in the code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveSheet, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Sub RDB_Selection_Range_To_PDF()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"ungroup the sheets and try the macro again"
Else
'Call the function with the correct arguments
'For a fixed range use this line
FileName = RDB_Create_PDF(Range("A10:I15"), "", True, True)
'For the selection use this line
'FileName = RDB_Create_PDF(Selection, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(Selection, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
End Sub
Sub RDB_Sheet_Level_Names_To_PDF()
Dim FileName As String
'Call the function with the correct arguments
FileName = Create_PDF_Sheet_Level_Names("addtopdf", "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'Create_PDF_Sheet_Level_Names("addtopdf", _
' "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End Sub
Laatst bewerkt: