Druck Liste mit VBA
Ich habe ein script geschrieben um im Hintergrund verlinkte PDF auf dem Dokument auszudrucken.
Nun würde ich dieses Script gerne auf Multiple Clients Ausführen. Es gibt da doch ein Problem da die Client aus einer Mischung von 32 und 64 bit systemen bestehen.
Ich würde gerne wissen was ich an meinem Script umschreiben / hinzufügen muss damit es auf allen Clients einwandfrei Funktioniert.
Hier ist der bisheriger Code welcher nur auf meinem Rechner Funktioniert.
Private Sub CommandButton1_Click()
If CheckBox1 = True Then
print_mypdf ("F:\Datenaustausch\PDF\01_Projects_an_appropriate_image_and_has_a_positive_attitude_and_is_genuine_EN.pdf")
End If
If CheckBox2 = True Then
print_mypdf ("F:\Datenaustausch\PDF\02_Has_a_healthy_degree_of_self-confidence_and_exercises_self-control_EN.pdf")
End If
If CheckBox3 = True Then
print_mypdf ("F:\Datenaustausch\PDF\03_Is_willing_to_accept_change_and_adapts_well_to_new_situations_EN.pdf")
End If
If CheckBox4 = True Then
print_mypdf ("F:\Datenaustausch\PDF\04_Gets_to_grips_with_new_information_quickly_and_thoroughly_EN.pdf")
End If
If CheckBox5 = True Then
print_mypdf ("F:\Datenaustausch\PDF\05_Has_excellent_analytical_skills_EN.pdf")
End If
If CheckBox6 = True Then
print_mypdf ("F:\Datenaustausch\PDF\06_Is_innovative_and_visionary_EN.pdf")
End If
If CheckBox7 = True Then
print_mypdf ("F:\Datenaustausch\PDF\07_Communicates_proposed_solutions_logically_EN.pdf")
End If
If CheckBox8 = True Then
print_mypdf ("F:\Datenaustausch\PDF\08_Has_well-developed_conceptual_skills_EN.pdf")
End If
If CheckBox9 = True Then
print_mypdf ("F:\Datenaustausch\PDF\09_Thinks_in_an_integrated_way_EN.pdf")
End If
If CheckBox10 = True Then
print_mypdf ("F:\Datenaustausch\PDF\10_Thinks_strategically_in_a_long-term_and_profit-focused_way_EN.pdf")
End If
If CheckBox11 = True Then
print_mypdf ("F:\Datenaustausch\PDF\11_Has_well-developed_organisational_and_planning_skills_EN.pdf")
End If
If CheckBox12 = True Then
print_mypdf ("F:\Datenaustausch\PDF\12_Simplifies_ processes_and_continuously_improves_them_EN.pdf")
End If
If CheckBox13 = True Then
print_mypdf ("F:\Datenaustausch\PDF\13_Acts_in_a_disciplined_way_and_concentrates_on_the_essentials_EN.pdf")
End If
If CheckBox14 = True Then
print_mypdf ("F:\Datenaustausch\PDF\14_Gets_on_with_other_people_easily_EN.pdf")
End If
If CheckBox15 = True Then
print_mypdf ("F:\Datenaustausch\PDF\15_Expresses_themselves_well_-_verbally_and_non-verbally_EN.pdf")
End If
If CheckBox16 = True Then
print_mypdf ("F:\Datenaustausch\PDF\16_In_writing_expresses_themselves_confidently_and_in_the_right_register_EN.pdf")
End If
If CheckBox17 = True Then
print_mypdf ("F:\Datenaustausch\PDF\17_Is_a_team-player_EN.pdf")
End If
If CheckBox18 = True Then
print_mypdf ("F:\Datenaustausch\PDF\18_Listens_actively_and_responds_to_the_other_person_and_gives_constructive_feedback_EN.pdf")
End If
If CheckBox19 = True Then
print_mypdf ("F:\Datenaustausch\PDF\19_Accepts_differing_opinions_and_creates_a_sense_of_trust_EN.pdf")
End If
If CheckBox20 = True Then
print_mypdf ("F:\Datenaustausch\PDF\20_Shows_a_clear_willingness_to_lead_EN.pdf")
End If
If CheckBox21 = True Then
print_mypdf ("F:\Datenaustausch\PDF\21_Acts_quickly_and_purposefully_EN.pdf")
End If
If CheckBox22 = True Then
print_mypdf ("F:\Datenaustausch\PDF\22_Good_at_identifying_and_delegating_competences_and_responsibilities_EN.pdf")
End If
If CheckBox23 = True Then
print_mypdf ("F:\Datenaustausch\PDF\23_Makes_decisions_and_accepts_responsibility_EN.pdf")
End If
If CheckBox24 = True Then
print_mypdf ("F:\Datenaustausch\PDF\24_Is_ambitious_and_identifies_with_the_company_EN.pdf")
End If
If CheckBox25 = True Then
print_mypdf ("F:\Datenaustausch\PDF\25_Is_flexible_and_willing_to_learn_EN.pdf")
End If
If CheckBox26 = True Then
print_mypdf ("F:\Datenaustausch\PDF\26_Takes_the_initiative_and_works_independently_EN.pdf")
End If
If CheckBox27 = True Then
print_mypdf ("F:\Datenaustausch\PDF\27_Is_able_to_motivate_themselves_and_others_EN.pdf")
End If
If CheckBox28 = True Then
print_mypdf ("F:\Datenaustausch\PDF\28_Creates_an_atmosphere_of_trust_EN.pdf")
End If
If CheckBox29 = True Then
print_mypdf ("F:\Datenaustausch\PDF\29_Recognises_and_develops_potential_EN.pdf")
End If
If CheckBox30 = True Then
print_mypdf ("F:\Datenaustausch\PDF\30_Argues_convincingly_EN.pdf")
End If
If CheckBox31 = True Then
print_mypdf ("F:\Datenaustausch\PDF\31_Defends_ their_position_forcefully_EN.pdf")
End If
If CheckBox32 = True Then
print_mypdf ("F:\Datenaustausch\PDF\32_Is_assertive_EN.pdf")
End If
If CheckBox33 = True Then
print_mypdf ("F:\Datenaustausch\PDF\33_Is_emotionally_resilient_EN.pdf")
End If
If CheckBox34 = True Then
print_mypdf ("F:\Datenaustausch\PDF\34_Handles_conflict_well_EN.pdf")
End If
If CheckBox35 = True Then
print_mypdf ("F:\Datenaustausch\PDF\35_Can_deal_with_criticism_and_setbacks_EN.pdf")
End If
End Sub
Sub print_mypdf(MyFile As String)
DoEvents
Shell "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe /p /h " & MyFile, vbHide
End Sub
Ich wäre SEHR dankbar, falls jemand mir Helfen könnte.
Freundliche Grüsse
Samuel Bernet
Nun würde ich dieses Script gerne auf Multiple Clients Ausführen. Es gibt da doch ein Problem da die Client aus einer Mischung von 32 und 64 bit systemen bestehen.
Ich würde gerne wissen was ich an meinem Script umschreiben / hinzufügen muss damit es auf allen Clients einwandfrei Funktioniert.
Hier ist der bisheriger Code welcher nur auf meinem Rechner Funktioniert.
Private Sub CommandButton1_Click()
If CheckBox1 = True Then
print_mypdf ("F:\Datenaustausch\PDF\01_Projects_an_appropriate_image_and_has_a_positive_attitude_and_is_genuine_EN.pdf")
End If
If CheckBox2 = True Then
print_mypdf ("F:\Datenaustausch\PDF\02_Has_a_healthy_degree_of_self-confidence_and_exercises_self-control_EN.pdf")
End If
If CheckBox3 = True Then
print_mypdf ("F:\Datenaustausch\PDF\03_Is_willing_to_accept_change_and_adapts_well_to_new_situations_EN.pdf")
End If
If CheckBox4 = True Then
print_mypdf ("F:\Datenaustausch\PDF\04_Gets_to_grips_with_new_information_quickly_and_thoroughly_EN.pdf")
End If
If CheckBox5 = True Then
print_mypdf ("F:\Datenaustausch\PDF\05_Has_excellent_analytical_skills_EN.pdf")
End If
If CheckBox6 = True Then
print_mypdf ("F:\Datenaustausch\PDF\06_Is_innovative_and_visionary_EN.pdf")
End If
If CheckBox7 = True Then
print_mypdf ("F:\Datenaustausch\PDF\07_Communicates_proposed_solutions_logically_EN.pdf")
End If
If CheckBox8 = True Then
print_mypdf ("F:\Datenaustausch\PDF\08_Has_well-developed_conceptual_skills_EN.pdf")
End If
If CheckBox9 = True Then
print_mypdf ("F:\Datenaustausch\PDF\09_Thinks_in_an_integrated_way_EN.pdf")
End If
If CheckBox10 = True Then
print_mypdf ("F:\Datenaustausch\PDF\10_Thinks_strategically_in_a_long-term_and_profit-focused_way_EN.pdf")
End If
If CheckBox11 = True Then
print_mypdf ("F:\Datenaustausch\PDF\11_Has_well-developed_organisational_and_planning_skills_EN.pdf")
End If
If CheckBox12 = True Then
print_mypdf ("F:\Datenaustausch\PDF\12_Simplifies_ processes_and_continuously_improves_them_EN.pdf")
End If
If CheckBox13 = True Then
print_mypdf ("F:\Datenaustausch\PDF\13_Acts_in_a_disciplined_way_and_concentrates_on_the_essentials_EN.pdf")
End If
If CheckBox14 = True Then
print_mypdf ("F:\Datenaustausch\PDF\14_Gets_on_with_other_people_easily_EN.pdf")
End If
If CheckBox15 = True Then
print_mypdf ("F:\Datenaustausch\PDF\15_Expresses_themselves_well_-_verbally_and_non-verbally_EN.pdf")
End If
If CheckBox16 = True Then
print_mypdf ("F:\Datenaustausch\PDF\16_In_writing_expresses_themselves_confidently_and_in_the_right_register_EN.pdf")
End If
If CheckBox17 = True Then
print_mypdf ("F:\Datenaustausch\PDF\17_Is_a_team-player_EN.pdf")
End If
If CheckBox18 = True Then
print_mypdf ("F:\Datenaustausch\PDF\18_Listens_actively_and_responds_to_the_other_person_and_gives_constructive_feedback_EN.pdf")
End If
If CheckBox19 = True Then
print_mypdf ("F:\Datenaustausch\PDF\19_Accepts_differing_opinions_and_creates_a_sense_of_trust_EN.pdf")
End If
If CheckBox20 = True Then
print_mypdf ("F:\Datenaustausch\PDF\20_Shows_a_clear_willingness_to_lead_EN.pdf")
End If
If CheckBox21 = True Then
print_mypdf ("F:\Datenaustausch\PDF\21_Acts_quickly_and_purposefully_EN.pdf")
End If
If CheckBox22 = True Then
print_mypdf ("F:\Datenaustausch\PDF\22_Good_at_identifying_and_delegating_competences_and_responsibilities_EN.pdf")
End If
If CheckBox23 = True Then
print_mypdf ("F:\Datenaustausch\PDF\23_Makes_decisions_and_accepts_responsibility_EN.pdf")
End If
If CheckBox24 = True Then
print_mypdf ("F:\Datenaustausch\PDF\24_Is_ambitious_and_identifies_with_the_company_EN.pdf")
End If
If CheckBox25 = True Then
print_mypdf ("F:\Datenaustausch\PDF\25_Is_flexible_and_willing_to_learn_EN.pdf")
End If
If CheckBox26 = True Then
print_mypdf ("F:\Datenaustausch\PDF\26_Takes_the_initiative_and_works_independently_EN.pdf")
End If
If CheckBox27 = True Then
print_mypdf ("F:\Datenaustausch\PDF\27_Is_able_to_motivate_themselves_and_others_EN.pdf")
End If
If CheckBox28 = True Then
print_mypdf ("F:\Datenaustausch\PDF\28_Creates_an_atmosphere_of_trust_EN.pdf")
End If
If CheckBox29 = True Then
print_mypdf ("F:\Datenaustausch\PDF\29_Recognises_and_develops_potential_EN.pdf")
End If
If CheckBox30 = True Then
print_mypdf ("F:\Datenaustausch\PDF\30_Argues_convincingly_EN.pdf")
End If
If CheckBox31 = True Then
print_mypdf ("F:\Datenaustausch\PDF\31_Defends_ their_position_forcefully_EN.pdf")
End If
If CheckBox32 = True Then
print_mypdf ("F:\Datenaustausch\PDF\32_Is_assertive_EN.pdf")
End If
If CheckBox33 = True Then
print_mypdf ("F:\Datenaustausch\PDF\33_Is_emotionally_resilient_EN.pdf")
End If
If CheckBox34 = True Then
print_mypdf ("F:\Datenaustausch\PDF\34_Handles_conflict_well_EN.pdf")
End If
If CheckBox35 = True Then
print_mypdf ("F:\Datenaustausch\PDF\35_Can_deal_with_criticism_and_setbacks_EN.pdf")
End If
End Sub
Sub print_mypdf(MyFile As String)
DoEvents
Shell "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe /p /h " & MyFile, vbHide
End Sub
Ich wäre SEHR dankbar, falls jemand mir Helfen könnte.
Freundliche Grüsse
Samuel Bernet
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 155151
Url: https://administrator.de/forum/druck-liste-mit-vba-155151.html
Ausgedruckt am: 20.04.2025 um 18:04 Uhr
9 Kommentare
Neuester Kommentar
Hallo Samu653 und willkommen im Forum!
Wenn es nur um die Berücksichtigung des Ordners "Program Files" in Abhängigkeit von der BS-Version geht, dann könntest Du den Aufruf des AdobeReaders etwa so formulieren:
Grüße
bastla
Wenn es nur um die Berücksichtigung des Ordners "Program Files" in Abhängigkeit von der BS-Version geht, dann könntest Du den Aufruf des AdobeReaders etwa so formulieren:
set WshShell = WScript.CreateObject("WScript.Shell")
AdobePath = WshShell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe"
Shell AdobePath & " /p /h " & MyFile, vbHide
bastla
@bastla
Warum nicht einfach:
Warum nicht einfach:
AdobePath = Environ("ProgramFiles") & "\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe"
Shell AdobePath & " /p /h " & MyFile, vbHide
Hallo Samu653!
Für den Moment kann ich Dir nur ein paar Anhaltspunkte liefern:
Grüße
bastla
Für den Moment kann ich Dir nur ein paar Anhaltspunkte liefern:
- Einen Ansatz zum Setzen des Standarddruckers hatten wir mal hier,
- eine Suche nach "VBA" und "Druckerauswahldialog" führt Dich zB da hin, und
- mit einem weiteren Umweg über VBS könntest Du zB auf die "EnumPrinterConnections-Methode" zurückgreifen ...
Grüße
bastla