Article View: pl.comp.bazy-danych.msaccess
Article #137620Zmiana skrótu na pulpicie
From: Jan Koc
Date: Thu, 26 Jul 2018 07:29
Date: Thu, 26 Jul 2018 07:29
59 lines
3574 bytes
3574 bytes
Dzień dobry.
Usiłuję zautomatyzować nowelizację bazy i nie umiem sobie poradzić z
1. Wklejeniem skrótu do bazy na pulpicie w to samo miejsce na którym był stary skrót (by nie wędrował po ekranie)
2. Jeśli użytkownik używa dwa lub więcej ekranów to program nie znajduje starego skrótu, jeśli jest on umieszczony na ekranie drugim
3. Jak wykonać operację podmianki skrótów jeśli użytkownik ma je umieszczone na pasku zadań lub w menu rozwijalnym
To co znalazłem w internecie chodzi poprawnie (oprócz w/w zastrzeżeń) i ma postać
Dim sPath, Scieżka_Folderu_Bazy As String
sPath = CurrentDb.Name
Scieżka_Folderu_Bazy = Left$(sPath, Len(sPath) - Len(Dir$(sPath)))
'tworzymy nowy
Dim wersja As String
Dim WScript
Dim WSHShell
Dim strDesktop
Dim oShellLink
Dim xx As Integer
Dim strComputer As String
Dim objWMIService
Dim colItems
Dim objItem
Dim strpath
Dim colFiles
Dim objFile
Dim a As String
'usuwam stary skrót
xx = DBEngine.Workspaces(0)(0).Containers("Databases").Documents("UserDefined").Properties("WersjaProg")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_ShortcutFile Where FileName = 'baza 2018 (" & xx & ")'")
For Each objItem In colItems
If InStr(objItem.Name, "desktop") Then
strpath = objItem.Name
strpath = Replace(strpath, "\", "\\")
Set colFiles = objWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & strpath & "'")
For Each objFile In colFiles
objFile.Delete
Next
End If
Next
'tworzę nowy skrót
xx = xx + 1
Set WSHShell = CreateObject("wscript.Shell")
strDesktop = WSHShell.SpecialFolders("Desktop")
Set oShellLink = WSHShell.CreateShortcut(strDesktop & "\Baza 2018 (" & xx & ").lnk")
oShellLink.TargetPath = Scieżka_Folderu_Bazy & "Baza 2018 (" & xx & ").accdb"
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+b"
oShellLink.WorkingDirectory = Scieżka_Folderu_Bazy
oShellLink.Save
Set WSHShell = Nothing
End Sub
Z góry dziękuję za pomoc
Jan Kociumbas
Technical Details
Message-ID:
<bd780dbd-5db0-4b72-804f-cfa096fbd2cd@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!e8-v6no164763qtp.0!news-out.google.com!e39-v6ni81qtb.0!nntp.google.com!e8-v6no164755qtp.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Received: by 2002:a0c:f788:: with SMTP id s8-v6mr380641qvn.31.1532590150519; Thu, 26 Jul 2018 00:29:10 -0700 (PDT) X-Received: by 2002:a37:21a4:: with SMTP id f36-v6mr10425qki.7.1532590150196; Thu, 26 Jul 2018 00:29:10 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!e8-v6no164763qtp.0!news-out.google.com!e39-v6ni81qtb.0!nntp.google.com!e8-v6no164755qtp.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: pl.comp.bazy-danych.msaccess Date: Thu, 26 Jul 2018 00:29:09 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.30.136.90; posting-account=PWJ4IAoAAAAF14TuSAASrVsGQI86DsCf NNTP-Posting-Host: 83.30.136.90 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <bd780dbd-5db0-4b72-804f-cfa096fbd2cd@googlegroups.com> Subject: Zmiana skrótu na pulpicie From: Jan Koc <jan.kociumbas@gmail.com> Injection-Date: Thu, 26 Jul 2018 07:29:10 +0000 Lines: 71 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit