Jump to content

read & copy data from certain cell in excel to notepad


Go to solution Solved by water,

Recommended Posts

as the title say, is it possible to do this? like read from A1 then if cell has value or not blank then copy and send the copied data to notepad?

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

Look at the _Excel_XX functions in the help file to help you get the information from an excel spreadsheet.

I'm not sure what you're planning to do with this data afterwards, but I'm sure that notepad isn't necessary to do it. Maybe explain better what it is you're attempting to do and we can help you with it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

what I want is read and copy data from excel sheet and paste it to any program like msword, wordpad or notepad. or read and copy data from msword, wordpad, or notepad then paste it to excel, I have lots of information to enter in documentation management program and need to automate copy and paste from excel to program, this program doesnt have eula or any agreement, so I think im not violating any rules and my company want to get the job done asap... I just use notepad for example. _Excel_XX functions, if this is a UDF what is the exact name of this function. I can do mouseclick mousemove send func to automate copy and paste, but sometimes its copying from wrong cell in excel thats my problem...

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

got another problem,

controlclick not working,

If WinActivate("[CLASS:XLMAIN]") Then
    MouseClick("Left", 1038, 216, 1, 1)
    Send("^c")
    Sleep(10)
    If WinActivate("[CLASS:TFrmMain]") Then
        ControlSend("[CLASS:TFrmMain]", "", "[CLASS:TEdit;INSTANCE:1]", "^v")
        Sleep(10)
        If WinActive("[CLASS:TFrmMain]") Then
            Send("{BS}!re")
            Sleep(10)
            If WinActive("[CLASS:TFrmRevSpecific]") Then
;this will be clicked automatically and document will popup but its not working, 
;Tried mousemove func, not working as well in this line
                ControlClick("[CLASS:TFrmRevSpecific]", "", "[CLASS:TBitBtn;INSTANCE:2]") 
            EndIf
        EndIf
    EndIf


EndIf

whats wrong with my code???

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

To read one or more cells from Excel use function _Excel_RangeRead from the Excel UDF.

In the help file you'll find example scripts.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

water your excel UDF is great but how can i paste it to another program? I browsed your UDF seems there's no way to paste it to other program like word notepad, or some program that has input box 

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

  • Solution

Please have a look at ControlSend.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

hi water this is how I copy and paste data from excel to DMS.

Func CHECK()
    If WinActivate("[CLASS:XLMAIN]") Then
        MouseClick("Left", 1038, 216, 1, 1)
        Send("^c")
        Sleep(10)
        If WinActivate("[CLASS:TFrmMain]") Then
            ControlSend("[CLASS:TFrmMain]", "", "[CLASS:TEdit;INSTANCE:1]", "^v")
            Sleep(10)
            If WinActive("[CLASS:TFrmMain]") Then
                Sleep(100)
                Send("{BS}")
                Sleep(10)
                Send("!re")
                MouseClick("Left", 249, 749, 2, 1)
                WinActivate("[CLASS:XLMAIN]")
                MouseClick("Left", 1907, 1023, 1, 1);Still experimenting not yet finish here...
            EndIf
        EndIf
    EndIf
EndFunc   ;==>CHECK

but i dont have any Idea how to paste it into DMS,MSWORD,NOTEPAD, using your udf, got stuck here:

#include <Excel.au3>

Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open Workbook 1
Local $oWorkbook1 = _Excel_BookOpen($oAppl,"C:\Book1.xlsx", True)

Local $oRange = $oWorkbook1.ActiveSheet.Range("A1")
_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange, "A2:B9"); im stuck here, no idea how to paste it to other program...

what im planning is like this:

#include <Excel.au3>

Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open Workbook 1
Local $oWorkbook1 = _Excel_BookOpen($oAppl,"C:\Book1.xlsx", True)

Local $oRange = $oWorkbook1.ActiveSheet.Range("A1")
_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange, "program.exe") ;paste it to program like notepad, wordpad, DMS, or msword

:mad2: :mad2: :mad2:

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

My program does not provide a way to copy data to another program.

You can only copy data from Excel to the clipboard.

_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

hey water I managed to copy it to notepad using your UDF thanks, your UDF is a big help for me..  :thumbsup:  :thumbsup:  :thumbsup:

edit: :ILA: :ILA: :ILA:

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • 8 months later...

Use _Excel_RangeRead to read cells into an Array and then use function ControlSend to send it to you application

or

With _Excel_RangeCopyPaste you copy tthe cells to the clipboard and then use AutoIt functions to read the clipboard and do whatever you need to do. 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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...