Private Sub Workbook_Open()
Worksheets("Tabelle1").Activate
End Sub
'--------------------------------------------------------------------------
'--- Projekt: VERKNUEPFUNG ---
'--- Modul: start ---
'--- Beschreibung: Start von Excel mit Tabelle ---
'--------------------------------------------------------------------------
'--- Erstellt von: Andre Schau ---
'--- am: 06.05.2007 ---
'--------------------------------------------------------------------------
'--- Änderungen: ---
'--- Datum Version Autor Beschreibung ---
'--- 07.05.2007 Notepad Erik M. Pfad von .vbs für .xls ---
'--------------------------------------------------------------------------
'--- Verknüpfung z.B.
'--- "C:\arbeitsblatt.vbs" "Pfeilrichtung.xls" "Tabelle2"
'--------------------------------------------------------------------------
'--- Allgemeine Definitionen ---
'--------------------------------------------------------------------------
Option Explicit
'--------------------------------------------------------------------------
'--- Konstanten ---
'--------------------------------------------------------------------------
'--- Allgemeines ---
'--- Fehlerkonstanten ---
Public Const ERR_OK_ = 0
Public Const ERR_CRITICAL_ = 2
Public Const ERR_CANCEL_ = -1
Public Const ERR_WARNING_ = -10
'--------------------------------------------------------------------------
'--- Variablen ---
'--------------------------------------------------------------------------
Public file_name
Public table_name
'--------------------------------------------------------------------------
'--- Programmfunktionen ---
'--------------------------------------------------------------------------
'--------------------------------------------------------------------------
'--- Main ---
'--------------------------------------------------------------------------
Dim err_code
Dim wshShell, oFileSystem
Dim oExcel, oWbk, fso, sfile, scriptpath
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oFileSystem = CreateObject("Scripting.FileSystemObject")
err_code = ERR_OK_
ScriptPfad 'Scriptpfad bestimmen
Parse_CMDLine 'Argumente auswerten
If err_code = ERR_OK_ Then
If NOT oFileSystem.FileExists (File_Name) Then 'prüfen, ob Datei vorhanden
err_code = ERR_CRITICAL_
wscript.echo "Datei <" & File_Name & "> nicht gefunden!"
wscript.quit
End If
Else
' Fehler bei Kommandozeilenauswertung
wscript.echo "Fehler: " & err_code & " " & err.description
wscript.quit
End If
'--- Excel Öffnen
Set oExcel = CreateObject("Excel.Application") 'Excel Objekt zuweisen
oExcel.visible = true 'Excel sichtbar starten
Set oWbk = oExcel.Workbooks.Open (File_Name, false, true) 'Mappe öffnen
oExcel.Worksheets(Table_Name).Activate 'Tabelle aktivieren
'--------------------------------------------------------------------------
'--- ENDE ----
'--------------------------------------------------------------------------
'--------------------------------------------------------------------------
Function Parse_CMDLine ()
'--- Liest die Parameter der Kommandozeile aus
Dim objArgs
On error resume next
err_code = 2
Set objArgs = WScript.Arguments 'Argumente Objekt zuweisen
File_Name= scriptpath & objArgs(0) 'erstes Argument
Table_Name= objArgs(1) 'zweites Argument
err_code = err.number 'fehlt ein Argument kommt error 9
End Function
Function ScriptPfad ()
set fso = CreateObject("Scripting.FileSystemObject")
scriptpath = fso.getparentfoldername(WScript.ScriptFullName) & "\"
End Function
Excel Arbeitsmappe als PDF
Sebi^ 23.01.2007 - 165 Hits - 4 Antworten
aus Excel Hyperlinks in pdf wandeln ???
HMu 15.08.2007 - 97 Hits -
Inhaltsverzeichnis mit Excel
micico 19.11.2007 - 133 Hits - 2 Antworten
Excel: Benannten Bereich auf mehreren Arbeitsblättern nutzen?
Chriss_netsw 06.02.2008 - 33 Hits - 8 Antworten