Questions tagged [excel-automation]
Use of Excel components and functionality from code, instead of using the GUI
126
questions
0
votes
1
answer
16
views
VBA Application-defined error Querying Data from a website
I am trying to query data from the website listed below in VBA. The query is resulting in a 1004 error--Application-defined or object-defined error.
This is the website: https://www.troa.net/tis/?...
0
votes
0
answers
26
views
Get the row of the active Excel cell in C++
I can't understand why it gives an error - an incorrect value. The task is to write a comment in the selected cell by the excel user.I'm trying to get the row and column of the active excel cell - I ...
0
votes
0
answers
26
views
conditional formatings runs well on vs code bt background color not showing on existing excel file
import pandas as pd
df = pd.read_excel('disk.xlsx')
def color(value):
if value == 'File Uploaded!' :
color = 'green'
else:
return
return f'background-color: {color}'
...
0
votes
2
answers
59
views
Excel not closing using the COM in Python
My Excel workbook not closed by executing the highlighted last statement.But throws the error as below..
My code....
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel....
1
vote
0
answers
67
views
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 ...
0
votes
1
answer
49
views
Cannot rename excel file
Imports System
Imports System.IO
Imports Microsoft.VisualBasic.FileIO
Imports Microsoft.Office.Interop
Module Program
Dim oxl As Excel.Application
Dim owbs As Excel.Workbooks
Dim owb As ...
0
votes
0
answers
105
views
Selecting filtered rows in excel using VB.net
Imports System
Imports System.IO
Imports Microsoft.VisualBasic.FileIO
Imports Microsoft.Office.Interop
Module Program
Dim oxl As Excel.Application
Dim owbs As Excel.Workbooks
Dim owb As ...
1
vote
1
answer
62
views
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 ...
1
vote
1
answer
78
views
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 ...
0
votes
2
answers
276
views
Confusion in creating excel application object using VB.net: CreateObject vs New
I am facing difficulty in understanding the following concepts. I had posted a question some time back - read through the answers but some things are still not clear. I state my confusion below:
My ...
0
votes
1
answer
147
views
Difference between CreateObject and New when opening a new excel application
What is the difference between the following two statements? I was writing a basic VB.net code which creates a new excel workbook and adds a new sheet. Both seem to be doing the same thing:
Dim oxl As ...
0
votes
1
answer
148
views
Updating a table "Y" in file "B" with new added rows from table "X" in file "A"
I am trying to create an "instant cloud flow" on Power Automate.
Context:
Excel file "A" contains a table "X" which gets updated regularly with new rows at the bottom ...
1
vote
0
answers
582
views
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 ...
1
vote
1
answer
20
views
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?
0
votes
0
answers
49
views
xlrd module skipping rows when looping over them
Im trying to loop over a spreadsheet of a standard, however, the xlrd module seems to skip some cells
My python code -
import xlrd
work_book = xlrd.open_workbook(f"standards/Core-information-...
0
votes
0
answers
322
views
How to run advance Macro in excel when cell value changes by formula
Why does code1 work, and code 2 doesn't?
The only difference I see is Macro in code 2 is more complex.
What I wanted to do
Run advance macro automatically when cell value changes due to formula. The ...
0
votes
0
answers
57
views
How to quickly copy and paste conditional formatting in Excel using C#
In my application, I need to copy user defined formatting from one range of cells over to another.
To do this I select the range where the formatting is defined, copy it to clipboard, select target ...
0
votes
0
answers
319
views
using System.Drawing not working in C# when executed in Linux Environment [duplicate]
I am generating an excel programmatically, but it works fine in VS, when I tried automating it and compiling via Linux environment, it shows error.
`
using System.Drawing;
ws1.View.FreezePanes(2, 1);
...
1
vote
1
answer
41
views
VBA Excel Automation (search for hundreds of little WorkBooks (same number of columns) to be queued in a unique Workbook
I wrote succesully in Visual Foxpro the research of the Workbooks in a specific customer's directory and subdir.
Now I want, starting by the first Workbook, append the the second just below the first ...
0
votes
0
answers
126
views
VBA Call Multiple Macros from Command Button and change one macro in loop - EXPETED FUNCTION OR VARIABLE
Sub Save_All_Files()
Call Account_Name_And_Year_1
Call Data_2021_1
Call Account_Name_And_Year_1
Call Data_2022_1
With Account_Name_And_Year_1
rootAccount = ...
0
votes
0
answers
27
views
VBA code to paste data from multiple workbooks into template by changing Pivot Fields
Wrote 3 different codes and Called them via Control Box in VBA, so now I've to select Root Account and Click One Button to create a report Single Account.
Is there a way to create such files for 50-...
0
votes
0
answers
24
views
Syntax is correct but showing Subscript out of range (Runtime error 9)
Not sure why I'm getting subscript out of range error on this code but as per my understandings the code is correct. This code was working fine few hours back but now getting this error. Can anyone ...
0
votes
1
answer
175
views
Getting a COM class factory Path not found exception when the path clearly exists
I'm trying to use Microsoft.Office.Interop.Excel library to convert a csv to an xlsx.
This is the function I am using
public static string ConvertToXlsx(string _sFilePath)
{
string _newFilePath = ...
1
vote
1
answer
86
views
One opened workbook does not see other opened workbook
We have this oldschool software which opens new Excel workbook and fills it with data. It does not do anything more. The workbook stays unsaved and opened.
Now I have created a macro which looks for ...
3
votes
1
answer
277
views
ExportAsFixedFormat's IgnorePrintAreas parameter seems not to have effect
In a Delphi application I am using since years the following code to export xlxs to pdf:
function TExportTool.ExportExcelToPDF(aFileName, aNewFileName: String): Boolean;
// reference : http://...
0
votes
2
answers
635
views
Office Script with Power Automate to Dynamically Change Excel Worksheet Date
I am using the following office script to hide a daily excel worksheet at the end of the work day. It runs fine when run from the script in excel, however, it fails when triggered by Power Automate ...
0
votes
1
answer
101
views
How do I use an Outlook macro to connect to an excel file that's already open?
I'm trying to write a Macro that will refer out to a file I use to track credits(I call it Master6 below). In the code excerpt below I try to do some initial testing like, see if excel is even running,...
0
votes
2
answers
178
views
How can I turn on Data/Filter mode on Excel sheets from MATLABvia ActiveX?
My MATLAB code produces data that I want to send to Excel. I use ActiveX Server in MATLAB to both produce the Excel file and to do the export (I can control more properties of the resulting Excel file ...
2
votes
1
answer
267
views
Using pattern matching to match an array with a non-zero lower bound
I'm writing code that calls Excel macros via COM Automation. There is a need to handle different return types and pattern matching is perfect for that:
var result = ExcelApp.Run("MyMacro", .....
0
votes
1
answer
389
views
Generating random float number in Python
I just want to generate random float numbers between the range.But i am facing some issue
This is my code
import xlsxwriter
import random
wb = xlsxwriter.Workbook('abc.xlsx')
ws = wb.add_worksheet()
...
0
votes
0
answers
163
views
PowerShell - Join excel files using ImportExcel
I am new to the PowerShell world, and my need is very simple. I found this utility https://github.com/dfinke/ImportExcel that meets my need but I could not find a suitable exampe But I am struggling ...
1
vote
2
answers
160
views
How to create an array like this in powershell?
I need to store data like below for TextToColumns Excel automation.
I need to implement Code-2 or Code-3 or Code-4 is that any way to achieve?
I have more than 350+ data so I cant use Code-1, that's ...
0
votes
0
answers
495
views
Find Next visible available Row in filtered data VBA
I am trying to write a program, where I must first apply the filter to Column S with 6 possible filter values (1,2,3,4,5,6). Once the filter is applied, I must copy the last used cell in column T and ...
0
votes
0
answers
127
views
Microsoft Graph workbook API - any standard way to prevent data races between multiple clients?
Scenario:
Two clients on different machines read a range of cells from a shared workbook (.../drive/{drive-id}/items/{id}/workbook/worksheets/{id|name}/range(address='...').
If they both don't find ...
1
vote
0
answers
29
views
I am trying to read excel file and its formulas and write them in new file by updating the formulas accordingly but got stuck to update them
I am trying to split excel spreadsheet based on columns and retain the formulas used in it. I was using openpyxl to read the formulas but got stuck as it reads formulas and write as it is but i need ...
3
votes
2
answers
2k
views
VB.Net Excel Automation how to handle Sensitivity Labels
When I'm creating an Excel file for a user in VB.Net, I am getting an error ("You can't perform this action when the file is read-only") when I try to save the file and it seems to be ...
0
votes
0
answers
146
views
Unprotect sheet in foxpro
I have an xlsm file that I need to insert data but my problem is that the xlsm in protected. I use the oWorkbook.Protect(,,.F.) to unprotect but the function is not working. I s there any way to ...
2
votes
1
answer
203
views
How to convert all columns to Text, while using TextToColumns, by default it was in General format - Using Powershell
I need to split texts using delimiter |.But after split its truncating front zeros:
Input
0001|00030455|testing
0003|00004532|testing
Expected Output
0001 00030455 testing
0003 00004532 testing
...
-2
votes
1
answer
144
views
Getting IE Automation Error "Object variable or with block variable not set"
I am Getting error while automating an existing IE window.
error is
"Object Variable or with block variable not set"
Code is
Sub accessExistingIEBrowser()
boolWindowFound = False
...
1
vote
0
answers
45
views
Excel Automation without Interop
We have excel reports which are having connections from external sources. We need to refresh these connections in a day twice. We are already having an application for this which uses Interop. Now we ...
-1
votes
2
answers
219
views
Multiple lookup in a closed workbook using ADO Connection
From the below Image I want to compare Second Workbook(Records.xlsm) with First Workbook(HandBook.xlsm)
I want to check if Department ID and Course ID Combination is valid by comparing it with the ...
0
votes
0
answers
87
views
MS Office last updates causing some strange behavior in handling VBA code
Our admins ran some MS Office 2016 updates (Build 11929.20838) and all of a sudden I noticed a few unexpected errors in one of my previously written Excel VBA macros. For example below error is ...
1
vote
0
answers
281
views
openpyxl: left right border for merged cell
The documentation says need to change only the top-left cell of merge cells.
ws.merge_cells(start_row=1, start_column=1, end_row=1, end_column=3)
ws.cell(1,1).border=Border(right=Side(border_style='...
0
votes
0
answers
93
views
How to copy data from One Excel sheet tab to another particular Workbook Tab Using Python
Can you please help me in copying data from a particular tab of excel sheet to another tab of excel sheet bearing the same name and data but in different workbook using Python.The workbook in which ...
0
votes
0
answers
353
views
Doc variables in Word template are not being updated from Excel VBA
I have certain ranges within an Excel file and I create an instance of Word template from within Excel VBA. This Word template has a bunch of Doc variables so that I can replace the values of those ...
0
votes
0
answers
125
views
Automation of Twinfield add in execution in Excel preferably using Python libraries
I have been trying to automate the process of executing the "Twinfield Analysis" add-in in Excel for quite some time. The challenge I face is that this add-in is needed to be clicked and ...
2
votes
1
answer
77
views
Print Timesheet PDFs
So my wife manages the timesheets for her employers company and has to print a pdf timesheet for each employee that worked on client A's project 1. For instance:
Client A - Project 1 - Employee 1 - ...
1
vote
1
answer
86
views
Excel: search if a specific keyword exists in a column
I was wondering if anyone out there can help to resolve the issue I am facing right now, actually I wanted to ask that I have 1 column with 5k + rows, and each row has a statement in it and if I ...
0
votes
0
answers
66
views
Query is not redirecting to original URL after submit Data on Webpage
I am trying to create multiple users on a web application using Excel VBA script. Below code works fine for the first row user creation but stops at set document for the second row. Actually Web app ...
0
votes
1
answer
31
views
Resize column width of a particular column
I need to resize excel particular column in a particular sheet.But not able to do so
Sub resizeColumn(sourceWb As String, Sheet As String, column As String)
Dim wkbSource As Workbook
Dim sheetName As ...