Questions tagged [excel-automation]

Use of Excel components and functionality from code, instead of using the GUI

Excel components can be controlled by programs. VB can do it directly and actually all Excel macros are written in that language. But also, using COM-automation, you can use Excel functionality from programs written in many other languages.

126 questions
2
votes
2 answers

openpyxl - "copy/paste" range of cells

I'm new to Python and I'm trying to adapt some of my VBA code to it using the openpyxl library. On this particular case, I'm trying to copy 468 rows in a single column from a workbook according to the string in the header and to paste them in…
Mahle
  • 23
  • 1
  • 1
  • 4
2
votes
1 answer

How to get the count the value in status using pandas.pivot_table?

Sample data: | Plan | Run | Status | Tested On | |------|----------|----------------|------------| | P0 | Agent | Passed | 2018-08-11 | | | Customer | Failed | 2018-08-01 | | P1 | A | Passed |…
2
votes
2 answers

Exception from HRESULT: 0x800A03EC when setting value of a cell (through Powershell)

I am trying to set a value to an excel cell through Powershell, and I am getting the error HRESULT: 0x800A03EC, which ends the script prematurely. I realize there have been other questions relating to this error or similar, but none of the solutions…
Alex C. Fish
  • 83
  • 2
  • 6
2
votes
1 answer

Formatting disinct columns with Variable but equal number of rows, and the columns are not adjacent

My data have 10+ columns and from that i want to select three columns and further format those three columns, but the no. of rows are not fixed so I'm unable to select all those three columns at once. Here is what I'm trying to do Dim lastrow As…
Digvijay
  • 406
  • 3
  • 12
2
votes
1 answer

Selecting distinct columns with dynamic rows

My data have 10+ columns and from that i want to select three columns and further format those three columns, but the no. of rows are not fixed so I'm unable to select all those three columns at once. Here is what I'm trying to do Dim lastrow As…
Digvijay
  • 406
  • 3
  • 12
2
votes
1 answer

When calling Excel from VB.NET app, how do I make Excel appear in front of app?

I have a VB.NET application that uses Microsoft.Office.Interop.Excel to simply open up a spreadsheet, pump over some data to it, refresh the data in the pivot tables and then present the user with the spreadsheet. The code is pretty simple (error…
2
votes
0 answers

Why wouldn't ITypeInfo::GetIDsOfNames work?

I am reworking some code for COM automation. Working with an IDispatch client for Excel (application), I can evaluate idispatch.GetIDsOfNames('Run' 'Macro' 'Arg1' 'Arg2') and it works. It returns an array with the memberID of the method for Run…
Carlos E. Ferro
  • 930
  • 10
  • 21
2
votes
0 answers

Interrupt running Excel VBA from C#

Everything I have read suggests this is impossible, but maybe someone knows something I do not. I developed middle-ware in C# for running different programs via COM or .NET interfaces. The other programs allow you to run them asynchronously, and…
Jim
  • 651
  • 2
  • 7
  • 15
2
votes
1 answer

Excel worksheet change event is not firing

I have created excel workbook using .NET interop. The excel workbook is created successfully through my C# code. When the user makes any changes in the excel, I want to do some stuff. I have used the ExcelWorkSheet.Change event. But this event is…
1
vote
1 answer

Autosave Outlook mail & its Attachments to Excel via VBA

I want to Save outlook Attachments from mails after Specific date via VBA. But my code is not doing anything. Someone Please tell what wrong am i doing ? I am using Office 365. I wrote following code but not solving the issue:- `Option…
1
vote
0 answers

How can I apply conditional formatting in C++ MFC?

https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb404903(v=office.12)?redirectedfrom=MSDN Microsoft provides example codes in C# and Visual Basic. For example C# code as follows. ApplicationClass excelApplication =…
1
vote
1 answer

I am having trouble with the Range.PasteSpecial() method in VB.net

I need to copy some data from one Excel workbook to another but I only need to copy values and formats. I don't know any other way of doing this but to use the PasteSpecial() method. The problem is that when I run the code I get this error…
1
vote
1 answer

Not able to extract value from a particular cell in excel sheet

I am trying to access the cell A7 of an excel file which has only one excel sheet. However i am getting the following error Public member 'Range' on type '__ComObject' not found. in the statement Dim tempValue As String =…
Joy G
  • 49
  • 1
  • 7
1
vote
0 answers

Excel SAP GUI - Automation Error Invalid Syntax

I logged into my SAP GUI and recorded a basic process to test using SAP GUI script recording option. After that I went to excel and wrote the following code. When I run it, I get the error : Run-time error'-2147221020(800401e4): Automation error…
1
vote
1 answer

Moving cells between cells in excel using python

I need to move cell D3 to D4 in excel if cell A3 is not equal to C3 can anyone tell how to do this using python?
1
2
3
8 9