Live-Forum - Die aktuellen Beiträge
Datum
Titel
29.03.2024 13:14:12
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1360to1364
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Mit VBScript die höchste Excel-Version starten

Mit VBScript die höchste Excel-Version starten
26.05.2014 00:31:44
Ewald
Hallo,
habe drei Excelversionen auf dem Rechner,2003,2007,2010 wie kann ich mit einem Script die höchste Version starten.
mit diesem nimmt er immer 2003
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open "c:\Upload\RLG2014\Start.xlsm"
Gruß Ewald

17
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 08:34:34
Raphael
Hallo Ewald,
ich würde es mal auf diese Art versuchen:

Sub öffnen()
Shell ("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe D:\Andy\Test.pdf")
End Sub
Gruess
Raphael

AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 09:50:34
Ewald
Hallo Raphael,
das ist nicht das was ich suche,
ich kenne den Speicherort von Excel nicht,bzw. es soll egal sein
Application nicht sichtbar, nur die Userform aus der Datei wird angezeigt(zweiter Teil ist klar)
es soll die höchste Installierte Version von Excel gestartet werden.
Gruß Ewald

AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 11:03:44
Nepumuk
Hallo,
anders als über Run wirst du das nicht gebacken bekommen, denn welche Version per CreateObject erstellt wird, hängt davon ab, welcher Version zuletzt in die Registry geschrieben wurde. Das ist wiederum davon abhängig, welche Version zuletzt einen Update erhalten hat der in die Registry eingetragen werden musste.
Ich würde das so machen:
Option Explicit

Dim vntVersion, vntPath, vntShellObject

Set vntShellObject = WScript.CreateObject("WScript.Shell")

On Error Resume Next

For vntVersion = 15 To 9 Step -1 'Excel 2013 - Excel 2000
    vntPath = vntShellObject.RegRead("HKLM\SOFTWARE\Microsoft\Office\" & _
        vntVersion & ".0" & "\Excel\InstallRoot\Path")
    If vntPath <> "" Then Exit For
Next

If vntPath <> "" Then
    vntShellObject.Run """" & vntPath & "Excel.exe" & """" & " " & """" & _
        "C:\Upload\RLG2014\Start.xlsm" & """", 0, False
Else
    MsgBox "Kein Excel installiert", 16, "Fehlende Installation"
End If

Set vntShellObject = Nothing

Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 09:54:34
EtoPHG
Hallo Ewald,
Set xlApp = CreateObject("Excel.Application.11")  ' Xl 2003
Set xlApp = CreateObject("Excel.Application.12")  ' Xl 2007
Set xlApp = CreateObject("Excel.Application.14")  ' Xl 2010
Set xlApp = CreateObject("Excel.Application.15")  ' Xl 2013

Gruess Hansueli

AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 11:10:06
Nepumuk
Hallo Hansueli,
das geht bei mir nicht. Egal welche Nummer ich angebe es wird immer 2003 gestartet obwohl ich 2007 parallel installiert habe.
Lass ich die Reparatur von Office 2007 laufen, dann ist diese Version die Standard-Excel.Application und es wird nur noch diese gestartet egal welche Nummer ich angebe.
Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 09:54:34
EtoPHG
Hallo Ewald,
Set xlApp = CreateObject("Excel.Application.11")  ' Xl 2003
Set xlApp = CreateObject("Excel.Application.12")  ' Xl 2007
Set xlApp = CreateObject("Excel.Application.14")  ' Xl 2010
Set xlApp = CreateObject("Excel.Application.15")  ' Xl 2013

Gruess Hansueli

AW: Mit VBScript die höchste Excel-Version starten
26.05.2014 13:50:50
Ewald
Hallo,
@ Hansueli
Das funktioniert bei mir auch nicht, es wird immer 2003 geöffnet.
@ Nepumuk
Das funktioniert schon mal die richtige Version wird geöffnet, habe nun noch einen Schönheitsfehler.
Im Aktivatecode der Userform wird die Titelleiste der Userform entfernt, öffne ich die Datei normal erscheint die Userform auch direkt ohne Titelleiste.
Wird die Datei aber über das Script geöffnet, erscheint die Userform zunächst mit Titelleiste und wird erst dann entfernt. Kann man dies noch optimieren.
Gruß Ewald

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
27.05.2014 09:56:24
Nepumuk
Hallo,
ich würde im Initialize-Event per LockWindowUpdate-Funktion das Anzeigen des Fensters unterdrücken (zu dem Zeitpunkt ist das Userform noch nicht sichtbar) und erst am Ende des Activate-Events dieses frei geben (da sollte die Caption schon unsichtbar sein).
Beispiel:
' **********************************************************************
' Modul: UserForm1 Typ: Userform
' **********************************************************************

Option Explicit

Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
    ByVal hwndLock As Long) As Long
Private Declare Function FindWindowA Lib "user32.dll" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long

Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"

Private mlngFormHwnd As Long

Private Sub UserForm_Activate()
    
    'mach irgendwas
    
    'Anzeige freigenben
    Call LockWindowUpdate(0&)
    
End Sub

Private Sub UserForm_Initialize()
    
    'Zugriffsnummer des UserFormfensters auslesen
    FormHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
    
    'Anzeige unterdrücken
    Call LockWindowUpdate(FormHwnd)
    
End Sub

Private Property Get FormHwnd() As Long
    FormHwnd = mlngFormHwnd
End Property

Private Property Let FormHwnd(ByVal pvlngFormHwnd As Long)
    mlngFormHwnd = pvlngFormHwnd
End Property

Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
28.05.2014 15:41:43
Ewald
Hallo Nepumuk,
so ganz paßt das noch nicht.
in dieser Arbeitsmappe steht folgender Code
Private Sub Workbook_Open()
Application.WindowState = xlMinimized
Start.Show
End Sub
füge ich jetzt nur deinen letzten Code in die Userform ein, wird diese nicht geöffnet, erst wenn ich unten auf die blinkende Exceldatei unten in der Taskleiste klicke,geht die Userform auf.
in Kombination mit dem Code zum Entfernen der Titelleiste
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetWindowRgn Lib "user32" ( _
ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
Private Declare Function ScreenToClient Lib "user32" ( _
ByVal hWnd As Long, _
lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" ( _
ByVal hWnd As Long, _
lpRect As RECT) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32" ( _
lpRect As RECT) As Long
Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
ByVal hwndLock As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private hWndForm As Long
Private mlngFormHwnd As Long
Private Const GWL_STYLE = -16
Private Const WS_CAPTION = &HC00000
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"
Private Property Get FormHwnd() As Long
FormHwnd = mlngFormHwnd
End Property
Private Property Let FormHwnd(ByVal pvlngFormHwnd As Long)
mlngFormHwnd = pvlngFormHwnd
End Property
Private Sub UserForm_Activate()
Call LockWindowUpdate(0&)
End Sub
Private Sub UserForm_Initialize()
Dim frmStyle As Long
Dim udtRect As RECT, lpBR As POINTAPI
If Val(Application.Version) > 8 Then
hWndForm = FindWindow("ThunderDFrame", Me.Caption)
Else
hWndForm = FindWindow("ThunderXFrame", Me.Caption)
End If
frmStyle = GetWindowLong(hWndForm, GWL_STYLE)
frmStyle = frmStyle And Not WS_CAPTION
SetWindowLong hWndForm, GWL_STYLE, frmStyle
DrawMenuBar hWndForm
GetWindowRect hWndForm, udtRect
lpBR.X = udtRect.Right
lpBR.Y = udtRect.Bottom
ScreenToClient hWndForm, lpBR
With udtRect
.Bottom = lpBR.Y - 18
.Left = 4
.Right = lpBR.X
.Top = 4
End With
SetWindowRgn hWndForm, CreateRectRgnIndirect(udtRect), True
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage hWndForm, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
geht die Userform zwar auf, bekomme aber vorher ein weißes Feld in Größe der Userform zu sehen.
Was ist da noch falsch
Gruß Ewald

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
29.05.2014 08:30:46
Nepumuk
Hallo,
na dann lass doch vorerst mal das Minimieren weg, damit du siehst was da vor sich geht. So etwas macht man auch erst ganz am Schluss, wenn das Programm fertig ist, nicht davor.
Gruß
Nepumuk

AW: Mit VBScript die höchste Excel-Version starten
29.05.2014 13:11:41
Ewald
Hallo Nepumuk,
das hatte ich auch zunächst ohne Minimieren getestet, da ändert sich aber auch nichts, bis auf die Tatsache, das die Userform nur mit deinem letzten Code jetzt angezeigt wird.
Bei der Kombination mit dem Code zum Ausblenden der Titelleiste ändert sich aber nichts.
Kurios ist auch wenn ich die Datei über Excel starte(Öffnen) funktioniert es. Starte ich aber über das Script bekomme ich das weiße Fenster.
Ein Fehler war noch in dem oben geposteten Code, hatte eine Deklaration vergessen, sieht jetzt so aus
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetWindowRgn Lib "user32" ( _
ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
Private Declare Function ScreenToClient Lib "user32" ( _
ByVal hWnd As Long, _
lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" ( _
ByVal hWnd As Long, _
lpRect As RECT) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32" ( _
lpRect As RECT) As Long
Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
ByVal hwndLock As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private hWndForm As Long
Private mlngFormHwnd As Long
Private Const GWL_STYLE = -16
Private Const WS_CAPTION = &HC00000
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"
Private Property Get FormHwnd() As Long
FormHwnd = mlngFormHwnd
End Property
Private Property Let FormHwnd(ByVal pvlngFormHwnd As Long)
mlngFormHwnd = pvlngFormHwnd
End Property
Private Sub UserForm_Activate()
Call LockWindowUpdate(0&)
End Sub
Private Sub UserForm_Initialize()
Dim frmStyle As Long
Dim udtRect As RECT, lpBR As POINTAPI
If Val(Application.Version) > 8 Then
hWndForm = FindWindow("ThunderDFrame", Me.Caption)
Else
hWndForm = FindWindow("ThunderXFrame", Me.Caption)
End If
frmStyle = GetWindowLong(hWndForm, GWL_STYLE)
frmStyle = frmStyle And Not WS_CAPTION
SetWindowLong hWndForm, GWL_STYLE, frmStyle
DrawMenuBar hWndForm
GetWindowRect hWndForm, udtRect
lpBR.X = udtRect.Right
lpBR.Y = udtRect.Bottom
ScreenToClient hWndForm, lpBR
With udtRect
.Bottom = lpBR.Y - 18
.Left = 4
.Right = lpBR.X
.Top = 4
End With
SetWindowRgn hWndForm, CreateRectRgnIndirect(udtRect), True
'Zugriffsnummer des UserFormfensters auslesen
FormHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
'Anzeige unterdrücken
Call LockWindowUpdate(FormHwnd)
End Sub
Gruß Ewald

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
30.05.2014 16:20:13
Nepumuk
Hallo,
bist du dir da sicher, dass du weißt was du da machst?
Versuches mal so:
Option Explicit

Private Declare Function FindWindowA Lib "user32.dll" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" ( _
    ByVal hWnd As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
    ByVal hWnd As Long, _
    ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32.dll" ( _
    ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
    ByVal hWnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Declare Function SetWindowRgn Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal hRgn As Long, _
    ByVal bRedraw As Boolean) As Long
Private Declare Function ScreenToClient Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    lpRect As RECT) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32.dll" ( _
    lpRect As RECT) As Long
Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
    ByVal hwndLock As Long) As Long

Private Type POINTAPI
    X As Long
    Y As Long
End Type

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private mlngFormHwnd As Long
Private Const GWL_STYLE = -16
Private Const WS_CAPTION = &HC00000
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"

Private Property Get FormHwnd() As Long
    FormHwnd = mlngFormHwnd
End Property

Private Property Let FormHwnd(ByVal pvlngFormHwnd As Long)
    mlngFormHwnd = pvlngFormHwnd
End Property

Private Sub UserForm_Activate()
    
    Call LockWindowUpdate(0&)
End Sub

Private Sub UserForm_Initialize()
    
    Dim frmStyle As Long
    Dim udtRect As RECT, lpBR As POINTAPI
    
    'Zugriffsnummer des UserFormfensters auslesen
    FormHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
    
    'Anzeige unterdrücken
    Call LockWindowUpdate(FormHwnd)
    
    frmStyle = GetWindowLong(FormHwnd, GWL_STYLE)
    frmStyle = frmStyle And Not WS_CAPTION
    SetWindowLong FormHwnd, GWL_STYLE, frmStyle
    
    DrawMenuBar FormHwnd
    
    GetWindowRect FormHwnd, udtRect
    
    lpBR.X = udtRect.Right
    lpBR.Y = udtRect.Bottom
    
    ScreenToClient FormHwnd, lpBR
    
    With udtRect
        .Bottom = lpBR.Y - 18
        .Left = 4
        .Right = lpBR.X
        .Top = 4
    End With
    
    SetWindowRgn FormHwnd, CreateRectRgnIndirect(udtRect), True
    
End Sub

Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
30.05.2014 22:47:46
Ewald
Hallo Nepumuk,
leider ist das weiße Fenster immer noch da,habe mal alles gepackt
https://www.herber.de/bbs/user/90923.zip
entpacke sie nach C:\Test und starte dann die VBS
um in die Datei zu kommen befindet sich unten links auf der Userform ein kleiner Button (sieht aus wie ein dicker Strich)
Gruß Ewald

AW: Mit VBScript die höchste Excel-Version starten
31.05.2014 11:47:11
Nepumuk
Hallo Ewald,
teste mal:
' **********************************************************************
' Modul: Start Typ: Userform
' **********************************************************************

Option Explicit

Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal crKey As Long, _
    ByVal bAlpha As Byte, _
    ByVal dwFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32.dll" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLongA Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32.dll" ( _
    ByVal hWnd As Long) As Long
Private Declare Function SendMessageA Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Declare Function SetWindowRgn Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    ByVal hRgn As Long, _
    ByVal bRedraw As Boolean) As Long
Private Declare Function ScreenToClient Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32.dll" ( _
    ByVal hWnd As Long, _
    lpRect As RECT) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32.dll" ( _
    lpRect As RECT) As Long

Private Type POINTAPI
    X As Long
    Y As Long
End Type

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Const GWL_EXSTYLE = -20&
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Private Const GWL_STYLE = -16
Private Const WS_CAPTION = &HC00000
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"

Private mlngFormHwnd As Long

Private Sub CommandButton1_Click()
    Unload Me
    Application.WindowState = xlMaximized
End Sub

Private Sub CommandButton2_Click()
    Application.ScreenUpdating = False
    Application.WindowState = xlMaximized
    Workbooks.Open Filename:=ThisWorkbook.Path & "\" & "WM2014.xlsm"
    ThisWorkbook.Close SaveChanges:=True
    Unload Me
    Application.ScreenUpdating = True
End Sub

Private Sub CommandButton3_Click()
    ThisWorkbook.FollowHyperlink Address:= _
        ThisWorkbook.Path & "\" & "Startinfo.htm", NewWindow:=True
End Sub

Private Sub CommandButton4_Click()
    ThisWorkbook.FollowHyperlink Address:= _
        ThisWorkbook.Path & "\" & "Kurzinfo.htm", NewWindow:=True
End Sub

Private Sub UserForm_Activate()
    SetLayeredWindowAttributes FormHwnd, ByVal 0&, 255&, LWA_ALPHA
End Sub

Private Sub UserForm_Initialize()
    
    Dim lngStyle As Long
    Dim udtRect As RECT, lpBR As POINTAPI
    
    FormHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
    
    lngStyle = GetWindowLongA(FormHwnd, GWL_EXSTYLE)
    lngStyle = lngStyle Or WS_EX_LAYERED
    SetWindowLongA FormHwnd, GWL_EXSTYLE, lngStyle
    SetLayeredWindowAttributes FormHwnd, ByVal 0&, 0&, LWA_ALPHA
    
    lngStyle = GetWindowLongA(FormHwnd, GWL_STYLE)
    lngStyle = lngStyle And Not WS_CAPTION
    SetWindowLongA FormHwnd, GWL_STYLE, lngStyle
    DrawMenuBar FormHwnd
    
    GetWindowRect FormHwnd, udtRect
    
    lpBR.X = udtRect.Right
    lpBR.Y = udtRect.Bottom
    
    ScreenToClient FormHwnd, lpBR
    
    With udtRect
        .Bottom = lpBR.Y - 18
        .Left = 4
        .Right = lpBR.X
        .Top = 4
    End With
    
    SetWindowRgn FormHwnd, CreateRectRgnIndirect(udtRect), True
    
End Sub

Private Sub UserForm_MouseDown(ByVal Button As Integer, _
        ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

    If Button = 1 Then
        ReleaseCapture
        SendMessageA FormHwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
    End If
End Sub

Friend Property Get FormHwnd() As Long
    FormHwnd = mlngFormHwnd
End Property

Private Property Let FormHwnd(ByVal pvlngFormHwnd As Long)
    mlngFormHwnd = pvlngFormHwnd
End Property

Hat aber eine Nebenwirkung, das Userform zuckt nach dem Öffnen einmal kurz. Besser werde ich es nicht hinbekommen.
Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
31.05.2014 23:04:05
Ewald
Hallo Nepumuk,
danke dir,das paßt jetzt und funktioniert so wie ich mir das vorgestellt habe.
Muß jetzt nur noch sehen wie ich in InnoSetup ein Icon für den Desktop und die Verknüpfung zur VBS erstellen kann.
Gruß Ewald

AW: Mit VBScript die höchste Excel-Version starten
01.06.2014 10:30:30
Nepumuk
Hallo,
das Icon kannst du als Source an InnoSetup übergeben. Entweder als einzelne Datei, oder als Inhalt eines Ordners. Den Desktop-Link kannst du per CreateShellLink-Funktion in InnoSetup selbst erstellen. Schau dir dazu die Hilfe zu Pascal Scripting an, denn du musst dazu in InnoSetup eine Code-Section erstellen.
Gruß
Nepumuk

Anzeige
AW: Mit VBScript die höchste Excel-Version starten
01.06.2014 19:56:57
Ewald
Hallo Nepumuk,
habe es hinbekommen
Name: "{userdesktop}\WM2014"; Filename: "{app}\Start.vbs";IconFilename: "{app}\Brasilien.ico"
Nochmal danke für deine Hilfe
Gruß Ewald

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige