How to control other applications Controls - excel

Am using SAP , outlook etc.. to analyse the data's
I need to control the Text boxes & Buttons in that application
For ex: I don't want to copy & paste the values in Outlook Search in mail items
Instead I need VBA to paste the values directly into the search text box in outlook and begin searching automatically without giving Copy & Paste manually
In the same way I need to control all Controls of other Applications (Word , SAP etc ) in Excel VBA
Please suggest me some codes

Prabu Mike,
Just my two cents. I use SAP and Excel as well.
In order to automate a lot of my work, I wrote some AutoHotKey scripts.
The scripts will e.g. read an array from Excel and use the data do populate SAP or create reports from SAP, through the standard SAP admin GUI.
If this is something you would like to know more about, let me know.
Regards,
Robert Ilbrink

Related

Outputting Information across Multiple Workbooks

I hope this is clear enough - please comment if additional information is required.
I have been asked to design an Excel / VBA tool which will display information on to a Summary worksheet based on user preferences. The home screen will ideally contain a top section having a number of checkboxes and dropdowns allowing the user to choose what information they would like to see: Finance, Activity & Customer Info. If the user selects Finance & Activity, this information will appear in 2 tables beneath.
The user will also see subsections i.e. Finance will include Balance & Arrears and like the above, the user can choose 1 or many of these to view information.
The dilemma I'm having is that the information is spread across different workbooks and I'm finding it difficult to find a quick and efficient method to extract data and output it to my worksheet. At the moment, I'm manually completing the process by conducting VLookups (each has a unique key) to create a Master spreadsheet and using pivots to display the information. This is too time consuming and isn't very visually appealling.
I'd like to use VBA to automate this process and have instant access to the information in the master spreadsheet based on user preferences.
It's also worth noting that this will be shared with users completely unfamiliar with Excel so I'm trying to veer away from the Drag & Drop Pivot Table approach.
If anyone has any suggestions on how I could create this system, you would be adding years on to my life.
Well, this is an extensive VBA macro that you need. I will give you some guidance on how you can start coding it.
The main idea here is to copy all data from other Workbooks and paste them in different sheets of the Workbook you are using to visualize the data and then hide these sheets. In this way, you can interact with all the data using only one Workbook.
So how do you do this? I recomend the following link:
https://www.excelcampus.com/vba/copy-paste-another-workbook/
To hide sheets use Sheets("sheet name").visible = false
To unhide sheets use Sheets("sheet name").visible = true
For the purpose of maintaining data updated, one way could be setting the macro to run when opening the file.
Check this link: https://support.microsoft.com/en-us/office/automatically-run-a-macro-when-opening-a-workbook-1e55959b-e077-4c88-a696-c3017600db44
Or you could just have a button to update.
Note: I've coded some VBA macros on Stackoverflow to move data between Workbooks that could maybe help. You can find them in the answers section of my profile.

Is it possible to save table data into another macro?

Does macro programming allow to read data from a table and hardcode it into another macro?
Situation is that I want to read all data from a worksheet with a macro. I then want to save that data without the help of an additional program to another macro so I can delete the table, restart my pc and still be able to retrieve all data from my macro.
You can "create a macro through a macro" (OPs words) through the VBIDE.
To so so, add a reference to Microsoft Visual Basic for Applications Extensibility. You can then write code to read and write to your VBA application. You will also need to set Trust access to the VBA project object model in the trust Center.
That said, there may be better ways to achieve what you want, eg
Hide the sheet using xlSheetVeryHidden so it's only accessable from VBA
Write the data to one or more hidden Names
If you are using .xlsm, these documents can also contain custom XML parts, which you can use to store arbitrary XML data in the documents. MSDN refrence: Custom Xml Part

is it possible to get a hyperlinked info from a website directly to excel?

Sometimes I need to get underlying e-mail addresses for several (20-30) hyperlinked texts (on a website) and copy them into excel. Is it possible to do it directly from a website rather than copying the info first as HTML into excel and then running a macro to get it from there.
That's what I currently use:
Function emailAddress(cell)
On Error Resume Next
emailAddress = Replace(cell.Hyperlinks(1).Address, "mailto:", "")
If emailAddress = 0 Then
emailAddress = ""
End Function
but I wonder if there is a way to bypass this step
There are a few ways you can accomplish this task.
The first is to load the website data right into a workbook:
Workbooks.Open Filename:="http://yoururlhere.com/data.html"
This is the most straightforward, as I'm sure you can specify if you wanted your data to go to a particular sheet.
The other would be to hook Internet Explorer using Excel. See this for example. This involves knowing more about how to access the different DOM elements of the page to get the information you need.
You could probably also write your data access in C# or VB.NET and use their Office Automation libraries to control Excel, but that will be more convoluted.
You could use View - Source in your webbrowser and copy the raw HTML into Excel. Then use Text to Columns to split on ":" plus some other clean up stuff. I'm not sure that saves you much.

How to automaticly copy & paste fields from excel into a website form

I have about 50 excel sheets to input on a website everyday, but unfortunately I can only submit 8 of these sheets per hour. Therefore, I'm looking for a tool, or comnbination of tools, that will allow me to automaticly copy & paste fields from Excel sheets, into a designated form on a website, and will allow me to set the time when every action should be completed.
The whole process can be done with just using the keyboard (using tab & several shortcuts), so maybe an automated script for keyboard commands is just what I need..
I really don't have much expierence with automated scripts etc, so if you got a suggestion, or a link, it would be much apreciated!
Thanks
Thomas
You can use AutoIt or PowerPro to do this kind of scripting.
More efficient, however, if the data is in a consistent table layout, is to use the Excel ODBC driver, and write a program to import the data. This will be more reliable than automating keystrokes, but will take more programming know-how.

How to generate Pivot table in ExcelSheet Programatically

I am required to generate a Pivot table in MS Excel(not in Open Office) dynamically as per the User's query.
I am programing in java and MySql(DB),so cant use the windows or MS object directly that's why wana to use VbScript . This vbscript will contain data as well as orentation on the columns in Pivot fieldList .But can any body tell me what script i should be using as i m very new to VB and objects of Excel.
The easiest way to find out what you need to do is to run Excel, switch on macro recording (under Tools > Macro > Record New Macro in Excel 2003 - the position may vary in other editions), then carry out the actions you want to automate (then stop recording).
If you then edit the macro you recorded (Tools > Macro > Macros), you should see the code which automates the actions you performed. This can be run as a VBScript with very little editing.
For an introduction to the basics of manipulating the Excel object model in VBScript this link looks as good as any.

Resources