Anzeige
Archiv - Navigation
1592to1596
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

Webseite positionieren

Webseite positionieren
27.11.2017 15:12:49
Gerhard
Hallo zusammen
Ist es möglich eine aus Excel via VBA geöffnete Webseite auf dem Bildschirm in Größe und Lage zu positionieren?
Vielen Dank
Gruß Gerhard

9
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Webseite positionieren
27.11.2017 16:23:15
Anton
Hallo Gerhard,
so?:
Sub b()
Dim IEApp As Object
Set IEApp = CreateObject("InternetExplorer.Application")
Do: Loop Until IEApp.Busy = False
With IEApp
.Navigate "deine Seite" 'anpassen
.StatusBar = False
.MenuBar = False
.Toolbar = False
.Resizable = False
'Koordinaten anpassen
.Width = 300
.Height = 300
.Left = 300
.Top = 300
.Visible = True
End With
Set IEApp = Nothing
End Sub
mfg Anton
AW: Webseite positionieren
27.11.2017 16:59:56
Gerhard
Hallo Anton
Vielen Dank zuerst einmal für Dein Makro.
Aber verwende nicht den Internet Explorer sondern Google Chrome
Wie müsste das beiliegende Makro erweitert werden sodass die geladene Webseite auch auf dem Bildschirm nach meinen Vorstellungen in Größe und Lage positioniert wird ?
Danke...
Gruß Gerhard
https://www.herber.de/bbs/user/117951.xls
Anzeige
AW: Webseite positionieren
27.11.2017 17:45:01
Anton
Hallo Gerhard,
wie man Google Chrome positioniert, weiß ich nicht, vielleicht kann Nepumuk was dazu schreiben.
mfg Anton
AW: Webseite positionieren
27.11.2017 18:15:46
Nepumuk
Hallo,
dazu benötige ich erst mal den Klassennamen des Google-Chrome Fensters. Denn den lade ich mir keinesfalls auf meinen Rechner.
Also, lass folgendes Makro laufen und schreib mir was in Spalte B neben der Überschrift des Chrome-Browsers in Spalte C steht.
Option Explicit

Private Declare Function EnumWindows Lib "user32.dll" ( _
    ByVal lpEnumFunc As Long, _
    ByVal lParam As Long) As Boolean
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" ( _
    ByVal hwnd As Long, _
    ByVal lpString As String, _
    ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" ( _
    ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" ( _
    ByVal hwnd As Long, _
    ByVal lpClassName As String, _
    ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" ( _
    ByVal hwnd As Long, _
    ByVal nIndex As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const WS_VISIBLE = &H10000000
Private Const WS_BORDER = &H800000

Private llngRow As Long

Public Sub Start()
    llngRow = 1
    Columns("A:C").ClearContents
    With Range("A1:C1")
        .Value = Array("Hwnd", "Klasse", "Caption")
        .Font.Bold = True
    End With
    Call EnumWindows(AddressOf WindowCallBack, ByVal 0&)
    Columns("A:C").AutoFit
    Tabelle1.Sort.SortFields.Clear
    Tabelle1.Sort.SortFields.Add Key:=Columns(2)
    With Tabelle1.Sort
        .SetRange Columns("A:C")
        .Header = xlYes
        .MatchCase = False
        .Apply
    End With
End Sub

Private Function WindowCallBack(ByVal lngHwnd As Long, ByVal lngParam As Long) As Long
    Dim strCaption As String, strClassName As String
    Dim lngReturn As Long, lngStyle As Long
    lngStyle = GetWindowLong(lngHwnd, GWL_STYLE)
    If lngStyle And (WS_VISIBLE Or WS_BORDER) <> 0 Then
        strClassName = Space$(256)
        lngReturn = GetClassName(lngHwnd, strClassName, 256)
        lngReturn = GetWindowTextLength(lngHwnd)
        strCaption = Space$(lngReturn)
        Call GetWindowText(lngHwnd, strCaption, lngReturn + 1)
        llngRow = llngRow + 1
        Cells(llngRow, 1).Resize(1, 3) = Array(lngHwnd, Trim$(strClassName), strCaption)
    End If
    WindowCallBack = 1
End Function


Gruß
Nepumuk
Anzeige
AW: Webseite positionieren
27.11.2017 20:01:58
Gerhard
Hallo Nepumuk
Wenn ich dein Makro Public Sub Start()
starte erscheint beiliegende Fehlermeldung
Gruß Gerhard
Userbild
AW: Webseite positionieren
28.11.2017 07:51:06
Nepumuk
Hallo Gerhard,
dann hast du ein 64Bit-Office. Da kann ich dir nicht weiterhelfen.
Gruß
Nepumuk
AW: Webseite positionieren
28.11.2017 09:08:01
Gerhard
Hallo Nepumuk
Alles klar
aber trotzdem vielen Dank für Deine Hilfe
Gruß Gerhard
AW: Webseite positionieren
28.11.2017 15:40:02
Anton
Hallo Gerhard,
wenn Internet Explorer verwendet werden durfte, dann so:
Private Sub CommandButton1_Click()
If Not IsEmpty(Range("B1").Value) Then
If LinkStatusOK(Range("B1").Value) Then
Call startIE(Range("B1").Value)
Else
Call MsgBox("Adresse nicht gefunden.", vbExclamation, "Hinweis")
End If
Else
Call MsgBox("Keine Adresse angegeben.", vbExclamation, "Hinweis")
End If
End Sub
Private Function LinkStatusOK(ByVal sURL As String) As Boolean
Dim xmlhttp As Object
Dim lngStatus As Long
Set xmlhttp = CreateObject("Msxml2.XMLHTTP")
On Error Resume Next
xmlhttp.Open "GET", sURL, False
xmlhttp.send
lngStatus = xmlhttp.Status
Set xmlhttp = Nothing
On Error GoTo 0
LinkStatusOK = lngStatus = 200
End Function
Private Function startIE(ByVal sURL As String)
Dim IEApp As Object
Set IEApp = CreateObject("InternetExplorer.Application")
Do: Loop Until IEApp.Busy = False
With IEApp
.Navigate sURL
.StatusBar = False
.MenuBar = False
.Toolbar = False
.Resizable = False
'Koordinaten anpassen
.Width = 300
.Height = 300
.Left = 300
.Top = 300
.Visible = True
End With
Set IEApp = Nothing
End Function
mfg Anton
Anzeige
AW: Webseite positionieren
28.11.2017 18:20:15
Gerhard
Hallo Anton
wie gesagt ich verwende nicht den Internet Explorer sondern Goggle Chrome!
Gruß Gerhard

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige