Solved

WshShell.SendKeys "{F5}"

Posted on 2010-11-11
8
2,377 Views
Last Modified: 2012-05-10
I have a MS Access database with the following code in the on-click event of a button, I am trying to see how I can insert a WshShell.SendKeys "{F5}" so that the dialog file on the list is automatically updated with the latest information uploaded on the SharePoint Site. I haven't been able to figure out how to do this in my existing form
'needs reference to microsoft office 12.0 object library

   Dim MyFilePath As String

   Dim MyFileDialog As Office.FileDialog

   Dim MyfileDFilter As Office.FileDialogFilter

   Dim strPath As String



   Set MyFileDialog = Application.FileDialog(msoFileDialogFilePicker)



   strPath = "http://teamsites......." '<<<<The SharePoint Site



   With MyFileDialog

      .Title = "Select Pic"

      .Filters.Clear

      .Filters.Add "Image Files", "*.jpg, *.bmp, *.gif"

      

      .FilterIndex = 2

      

      .ButtonName = "Select"

      .InitialView = msoFileDialogViewDetails

      .InitialFileName = strPath

      If .Show = -1 Then

         MyFilePath = CStr(MyFileDialog.SelectedItems.Item(1))

      Else

        

      End If

   End With

Me.txtFilePath = MyFilePath

Open in new window

0
Comment
Question by:joeserrone
  • 4
  • 3
8 Comments
 
LVL 6

Accepted Solution

by:
YohanF earned 500 total points
ID: 34111179
why dont you just use SendKeys "{F5}" or use Refresh function ?
0
 

Author Comment

by:joeserrone
ID: 34111211
I tried placing WshShell.SendKeys "{F5}" and also me.refresh on line 8 of my code but didn't work, do you have any ideas how my code would look like?
0
 
LVL 6

Expert Comment

by:YohanF
ID: 34111309
Does the dialog file open from the initial folder location you have given, it should be automatically refreshed without having to explicitly do it.. Or am I understanding the problem wrong?
0
 

Author Comment

by:joeserrone
ID: 34111495
I thought that too but it doesn't refresh it, I have to manually press F5 in order to refresh it
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 6

Expert Comment

by:YohanF
ID: 34111657
So when you press the F5 key does that get refreshed???

Also check whether there is a caching mechanism in your network, that could be a problem causer...

what about DoCmd.RunCommand acCmdRefresh command ?? also insert that just before "If .Show = -1 Then" line....

Hope this will work for you..

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34114854
I don't see {F5} anywhere in the code you posted?

Can you post the code where you tried it and it did not work?
0
 

Author Comment

by:joeserrone
ID: 34120227
I tried the "DoCmd.RunCommand acCmdRefresh " option but didn't work, to answer Boag2000 question... attached is the code I tried to run using the {F5} option
'needs reference to microsoft office 12.0 object library

   Dim MyFilePath As String

   Dim MyFileDialog As Office.FileDialog

   Dim MyfileDFilter As Office.FileDialogFilter

   Dim strPath As String



   Set MyFileDialog = Application.FileDialog(msoFileDialogFilePicker)

WshShell.SendKeys "{F5}" 

   strPath = "http://teamsites......." '<<<<The SharePoint Site



   With MyFileDialog

      .Title = "Select Pic"

      .Filters.Clear

      .Filters.Add "Image Files", "*.jpg, *.bmp, *.gif"

      

      .FilterIndex = 2

      

      .ButtonName = "Select"

      .InitialView = msoFileDialogViewDetails

      .InitialFileName = strPath

      If .Show = -1 Then

         MyFilePath = CStr(MyFileDialog.SelectedItems.Item(1))

      Else

        

      End If

   End With

Me.txtFilePath = MyFilePath

Open in new window

0
 

Author Closing Comment

by:joeserrone
ID: 34148676
This advice is good but I can't get it to work on my code
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Direct Mail software 4 46
Create Form using Wizard 14 39
selection of current record jumps to a non-selected record 8 39
Update Access FrontEnd by Version # 9 29
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now