Jump to content
Sign in to follow this  
13lack13lade

EXCEL & GUI

Recommended Posts

13lack13lade

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

Share this post


Link to post
Share on other sites
water

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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
13lack13lade

worked perfectly, thanks water!

Share this post


Link to post
Share on other sites
water
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×