Jump to content

EXCEL & GUI


Recommended Posts

Hi Guys,

I have a label linked to a cell in excel, which is actually linked to another workbook to pull the information from so that i can have 1 mainbook, and 1 'shell' so that i dont have any problems with my script locking the main excel file.

However i am just thinking is there a way in the GUI to update the label and then close the spreadsheet it is reading from. or only read without opening?

My main concern is that once i have more than 1 person using the script, it will lock the shell record and wont update if i change the main spreadsheet...

I am unable to test myself - does anyone know if this will be an issue or will excel automatically update it?

This is how my script is currently set up, keep in mind this is the first form only.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Excel.au3>


$oExcel = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "MainUpdateShell.xlsx",0)
$mainupdate = _ExcelReadCell($oExcel,1,1)


#Region ### START Koda GUI section ### Form=
$MainSreen_1 = GUICreate("Dashboard", 1176, 756, 256, 99)
$Banner = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Images\banner.jpg", 0, 0, 1177, 137, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER))
$Trackingbtn = GUICtrlCreateButton("Tracking", 8, 296, 169, 49)
$Loadbtn = GUICtrlCreateButton("Load Guide", 8, 368, 169, 49)
$Quicklinksbtn = GUICtrlCreateButton("QuickLinks", 8, 440, 169, 49)
$Dataloadbtn = GUICtrlCreateButton("Dataload", 8, 512, 169, 49)
$Formsbtn = GUICtrlCreateButton("Forms", 8, 584, 169, 49)
$Overall = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\OverallChart.jpg", 688, 152, 481, 337)
$Logo = GUICtrlCreatePic("C:\Users\webbth\Pictures\Untitled1.jpg", 8, 152, 169, 121, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER))
$Feedbackbtn = GUICtrlCreateButton("Dashboard Feedback", 8, 656, 169, 49)
$MainData = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\myfile.jpg", 192, 504, 977, 209,$WS_BORDER)
$Label1 = GUICtrlCreateLabel($mainupdate, 192, 152, 484, 340, $WS_BORDER)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$MainLogo = GUICtrlCreateLabel("FCGP Dashboard", 400, 40, 420, 79)
GUICtrlSetFont(-1, 48, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(Default, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit


EndSwitch
WEnd
Edited by 13lack13lade
Link to comment
Share on other sites

Use

$oExcel = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "MainUpdateShell.xlsx", 0, True)

to make sure that the workbook is opened read-only. And add a _ExcelBookClose as soon as possible to release the ressource.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...