1

Here is a background of my project.

I have an arduino with an LCD screen. This arduino is connected to an excel spreadsheet through a user form. The LCD screen displays values from the excel spreadsheet. If I change the value in excel, it changes the value on the LCD screen.

Taking it a step further, All of our data (for now) is in MS access, so, I imported the data from access to excel. Now, if I change a value in MS access, it changes it in excel, then changes it on the LCD screen.

This works great, but I have one issue. There is a user-form that will be continuously running (this is the connection between the arduino and excel sheet). When this form is open, the excel spreadsheet will not refresh when something in access is changed. Once I close the form, the linked table in excel will refresh.

Any ideas how to have the excel refresh the link with the form open? I have tried refreshall, updatelinks, etc. Thank you!

Community
  • 1
  • 1
niva5171
  • 11
  • 1
  • just a shot in the dark, but have you tried making the userform modeless? https://msdn.microsoft.com/en-us/library/office/gg251540.aspx – sous2817 Jun 23 '16 at 15:48
  • I haven't, but I have made it so the code runs without the form. But the excel spreadsheet won't refresh. The code loops continuously. – niva5171 Jun 23 '16 at 15:55
  • Can you post your code? How is the sheet being updated? – sous2817 Jun 23 '16 at 16:01
  • Here is the update portion. Most of the actual code was from some other person. But, here is what is being used to update the sheet, and link: ActiveWorkbook.UpdateLink ("Shelf 1") ActiveWorkbook.RefreshAll DoEvents I may be using the update link incorrectly. "Shelf 1" is the name of the linked querry. – niva5171 Jun 23 '16 at 16:06

2 Answers2

0

I'm assuming the user form is in Excel in which case DoEvents might be worth a try

0

How about having vba code close and reopen the form periodically, the link shows how to create a timed event

VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

Community
  • 1
  • 1
  • I actually narrowed it down further. I have the code running (and working) without the form. It is a loop that continuously runs. I have within that loop to refresh the workbook, but it doesnt execute. So, I have found that as long as code is running, it won't refresh the page. Even with DoEvents. – niva5171 Jun 23 '16 at 15:54