Vpiši se  \/ 
x
or
x
Registracija  \/ 
x

or

Kako ohraniti okno Excela vedno na vrhu?

Ste si kdaj zaželeli, da bi bila vaša okna Excel vedno na vrhu in naj jih ne bi pokrivala druga okna? Na žalost Excel ne ponuja funkcije za reševanje te naloge. Tukaj pa vam lahko dam kodo VBA za reševanje tega posla.

Okno Excel naj bo vedno na vrhu s kodo VBA


puščica modri desni mehurček Okno Excel naj bo vedno na vrhu s kodo VBA


Naslednja koda VBA vam lahko pomaga, da je okno Excel vedno na vrhu, koda se uporablja tako za 32-bitno pisarno kot za 64-bitno pisarno.

1. Držite tipko ALT + F11 tipke za odpiranje Okno Microsoft Visual Basic for Applications.

2. Kliknite Vstavi > Moduliin prilepite naslednjo kodo v Okno modula.

Koda VBA: Excelovo okno naj bo vedno na vrhu

'Update 20140909
#If Win64 Then
    Public Declare PtrSafe Function SetWindowPos _
        Lib "user32" ( _
            ByVal hwnd As LongPtr, _
            ByVal hwndInsertAfter As LongPtr, _
            ByVal x As Long, ByVal y As Long, _
            ByVal cx As Long, ByVal cy As Long, _
            ByVal wFlags As Long) _
    As Long
#Else
    Public Declare Function SetWindowPos _
        Lib "user32" ( _
            ByVal hwnd As Long, _
            ByVal hwndInsertAfter As Long, _
            ByVal x As Long, ByVal y As Long, _
            ByVal cx As Long, ByVal cy As Long, _
            ByVal wFlags As Long) _
    As Long
#End If
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Sub ShowXLOnTop(ByVal OnTop As Boolean)
    Dim xStype As Long
    #If Win64 Then
        Dim xHwnd As LongPtr
    #Else
        Dim xHwnd As Long
    #End If
    If OnTop Then
        xStype = HWND_TOPMOST
    Else
        xStype = HWND_NOTOPMOST
    End If
    Call SetWindowPos(Application.hwnd, xStype, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
End Sub
Sub SetXLOnTop()
    ShowXLOnTop True
End Sub
Sub SetXLNormal()
    ShowXLOnTop False
End Sub

3. Nato pritisnite F5 tipko za zagon te kode in a Makri odpre se pogovorno okno, izberite SetXLOnTop in kliknite Run gumb.

doc-keep-excel-on-top-1

4. In potem bo vaše Excelovo okno vedno na vrhu drugih aplikacij.

Opombe: Če želite okno Excel vrniti v normalno stanje, samo pritisnite F5 ključ, da odprete Makri pogovorno okno, izberite SetXNormal in kliknite Run.


Najboljša orodja za pisarniško produktivnost

Kutools za Excel rešuje večino vaših težav in poveča produktivnost za 80%

  • Ponovna uporaba: Hitro vstavite zapletene formule, grafikoni in vse, kar ste že uporabljali; Šifriraj celice z geslom; Ustvari poštni seznam in pošiljanje e-pošte ...
  • Vrstica Super Formula (enostavno urejanje več vrstic besedila in formule); Bralna postavitev (enostavno branje in urejanje velikega števila celic); Prilepite v filtrirani obseg...
  • Združi celice / vrstice / stolpce brez izgube podatkov; Vsebina razdeljenih celic; Združi podvojene vrstice / stolpce... prepreči podvojene celice; Primerjaj obsege...
  • Izberite Duplicate ali Unique Vrstice; Izberite prazne vrstice (vse celice so prazne); Super Find in Fuzzy Find v mnogih delovnih zvezkih; Naključna izbira ...
  • Natančna kopija Več celic brez spreminjanja sklica formule; Samodejno ustvarjanje referenc na več listov; Vstavi oznake, Potrditvena polja in še več ...
  • Izvleček besedila, Dodaj besedilo, Odstrani po položaju, Odstrani presledek; Ustvari in natisni vmesne seštevke strani Pretvarjanje med vsebino celic in komentarji...
  • Super filter (shranite in uporabite sheme filtrov za druge liste); Napredno razvrščanje glede na mesec / teden / dan, pogostost in drugo; Poseben filter s krepko, ležeče ...
  • Združite delovne zvezke in delovne liste; Spoji tabele na podlagi ključnih stolpcev; Razdelite podatke na več listov; Paketna pretvorba xls, xlsx in PDF...
  • Več kot 300 zmogljivih funkcij. Podpira Office / Excel 2007-2019 in 365. Podpira vse jezike. Preprosta namestitev v vašem podjetju ali organizaciji. Vse funkcije 30-dnevnega brezplačnega preskusa. 60-dnevno jamstvo za vračilo denarja.
zavihek kte 201905

Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50% in vsak dan zmanjša na stotine klikov z miško!
dno pisarniške mize
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Todd Conner · 5 months ago
    Does this code have to be applied to each excel file separately or can the macro be saved within excel to be toggled on/ off whenever a new Excel workbook is open?
  • To post as a guest, your comment is unpublished.
    Freediv · 2 years ago
    Hello

    It seems that xHwnd defined to store Application.hWnd before calling SetWindowPos as below:

    xHwnd = Application.hWnd
    Call SetWindowPos(xHwnd, xStype, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)

    Thanks
  • To post as a guest, your comment is unpublished.
    Prof. LI · 2 years ago
    Absolute genius. Exactly what I needed. Thanks!!!
  • To post as a guest, your comment is unpublished.
    dceldeen@gmail.com · 2 years ago
    Thanks so much for this! I needed to keep my automated system stats sheet up at all times while I did other things based on what it was showing me. Very helpfull! :D
  • To post as a guest, your comment is unpublished.
    Kels · 4 years ago
    Thanks .. God Bless..!
  • To post as a guest, your comment is unpublished.
    Sam · 4 years ago
    Thanks for this. Very helpful when transposing data from multiple systems onto a spread sheet. Appreciate the code!
  • To post as a guest, your comment is unpublished.
    Clark · 5 years ago
    Thanks for the help!!! I had to use this as a workaround because you cant have two workpages open at the same time. Appreciate you sharing your code :)
  • To post as a guest, your comment is unpublished.
    Eric H · 6 years ago
    Love this!! Great code. Thanks! I'm a beginning programmer, I just barely know what it does.

    Where would I change in the code if I wanted the window to jump to a certain size, hide the ribbon, and/or jump to a certain sheet or cell range?
  • To post as a guest, your comment is unpublished.
    JennyRae · 6 years ago
    Thanks for providing this code! So helpful. I've been using Judy ten key for this feature but now I can use excel. Awesome, thank you!!