Jump to content

Write Data into Excel using GUICreate.


Recommended Posts

I want to send/write data into excel book using Gui created.

form1.JPG.d7aa18b15395f0256631a42e5467a6e8.JPG

 

excel.JPG.57215928c5e49e324b54610004da60d9.JPG

My code :

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include<File.au3>
#include <Date.au3>
#NoTrayIcon
#RequireAdmin
Local $iWidthCell = 100

$Form1 = GUICreate("form1", 550, 251, -1, -1)
GUICtrlCreateLabel("Username: ", 30, 55, $iWidthCell) ; first cell 70 width
$Input1 = GUICtrlCreateInput("", 100, 50, 400, 21)

GUICtrlCreateLabel("Area Code: ", 30, 85, $iWidthCell)
$Input2 = GUICtrlCreateInput("", 100, 80, 400, 21)

GUICtrlCreateLabel("Village: ", 30, 115, $iWidthCell)
$Input2 = GUICtrlCreateInput("", 100, 110, 400, 21)

GUICtrlCreateLabel("Today's Date: ", 30, 145, $iWidthCell)
$Input2 = GUICtrlCreateInput(_NowDate(), 100, 140, 400, 21)
GUICtrlSetState(-1, $GUI_DISABLE)

$Button1 = GUICtrlCreateButton("Save", 300, 188, 75, 25)
GUICtrlSetTip(-1, "Save...")
$Button2 = GUICtrlCreateButton("Exit", 400, 188, 75, 25)
GUICtrlSetTip(-1, "Exit...")
GUISetState()
While 1
    Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE
     FileClose($open)
            Exit
        Case $Button1
            OK()
        Case $Button2
            Close()
    EndSwitch
WEnd

Func OK()

EndFunc
Func Close()
    Exit
EndFunc

I don't know about Excel automation.

Its Possible ?

 

Link to post
Share on other sites
1 minute ago, iamtech said:

Yes, But How can i use it with Gui ?

GUICtrlRead() to read values from the GUI, _Excel_RangeWrite() to write to the Worksheet.

2 minutes ago, iamtech said:

and what happen if data already exist in first/second/third row.

I want to send data only on empty row.

This is a check that you have to do prior writing to the Sheet, but you can do everything with Excel UDF; just take a look at it and post the code related to Excel UDF if you have to ask something.

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to post
Share on other sites
  • Developers
10 minutes ago, iamtech said:

Yes, But How can i use it with Gui ?

and what happen if data already exist in first/second/third row.

I want to send data only on empty row.

@iamtech or should I say @naru?   
Do you seriously think we will allow your begging for code approach when you use 2 different accounts?

You better read our forum rules now first and then PM me with which account you want to continue your life here.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
7 minutes ago, Jos said:

@iamtech or should I say @naru?   
Do you seriously think we will allow your begging for code approach when you use 2 different accounts?

You better read our forum rules now first and then PM me with which account you want to continue your life here.

Jos

Ohh ! i am Not @naru, Naru is my elder brother.

Link to post
Share on other sites
  • Developers
Just now, naru said:

Ohh ! i am Not @naru, Naru is my elder brother.

mmmm...   you know you are writing this with the Naru account, not iamtech ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • Developers

After a little research I know I am being played so simply will ban your both account. Do not attempt to create a new one.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • Jos locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...