System.NullReferenceException Epplus Opening Worksheet [closed] - epplus

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I am using Epplus to try to open and read a spreadsheet -- a regular spreadsheet with four columns in xlsx format. I run my code, get the Null Reference error, then tell it to resume and the error is gone. It's like the package isn't fully loaded. I've tried .Sleep(5000) but that doesn't work. I've tried it in and out of USING statement.
if (!File.Exists(FileName))
{
return;
}
ExcelPackage pkg = new ExcelPackage(new FileInfo(FileName));
ExcelWorksheet ws = pkg.Workbook.Worksheets.First(); <<-- ERROR HERE
Any help, advice or insight would be greatly appreciated.

I'm posting this in case anyone else has this problem. I created a new Excel File and it worked. I tried it out on a bunch of other files and it worked.
The problem was specific to this file. I don't know if it was because it had special formatting or several sheets -- whatever it was, a particular Excel file was creating the problem.

I think EPPLUS cannot handle .xls (or the old excel type), I resolve mine too, when i save a new copy that has .xlsx file type. and it works!

Related

objShell.Run changes with Windows 10 v1909 [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Since I upgraded to the newer version 1909 last week, simple Outlook macros no longer work.
I want to execute batches and VBS scripts via button.
My code is e.g:
Sub busy()
strPath = "C:\Users\xxxxxxx\Documents\Addons\busy.vbs"
Set objShell = CreateObject("WScript.Shell")
objShell.Run strPath, 1, False
End Sub
I get the error message since the update:
Runtime error '-2147024894 (80070002)':
The method "Run" for the object "IWshShell3" failed.
What do I have to change to make it work again? The call ran wonderfully before.
Opening the scripts manually, e.g. via Windows Explorer, is no problem.
If there are spaces in the path make sure your path is sourunded by quotes:
strPath = """C:\Users\xxx xx xx\Documents\Addons\busy.vbs"""

Where is code I get in MS ACCESS in MDB or MDE file extension [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I m newly to the MS access, I didn’t getting where is the code see and edit. So I can login to my application.
When try open the my application in .MDE in MSAccess I am getting authorisation error-> your login is unauthorised please try again later.
Please answer me
An MDE file is an old compiled version of an MDB database. As such you cannot normally get at the code, so if you don't have the original MDB file you are in trouble! These people provide a commercial service to restore a MDB from a MDE. I have never needed to use them, so cannot comment on how reliable the result is.
Open the MDB file.
Press Alt+F11 to open the VBE, the VBA code editor.
That's where your code is.

excel vba Getting error "Out of Memory" [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am working on excel VBA. In my code I am downloading Multiple files say 50 one by one.
What I am doing, I'm downloading first file making changes doing some calculation and saving it as xlsx and after that downloading another file and doing calculation saving it as xlsx and so on. So After downloading 26-27 files I am getting "Out of Memory" Error.
Can anyone suggest me how to clear memory after downloading each file.
Thank you so much in advance
Perhaps consider setting your variables to Nothing? That way the objects will be destroyed and memory resource released.
There are a couple of posts that may give you some more insights. Worth checking them out.
When should an Excel VBA variable be killed or set to Nothing?
Excel VBA: Does destroying a collection of objects destroy every single object?

VBA errors not popping up when the code fails [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I know this is probably a little backwards but in this case I want the errors. I am working on a project and I am no longer getting pop up run time errors in VBA. The code just stops and I have to go step by step to find it. I must have done something to make it stop doing this but I have no idea what it was.
Any suggestions?
Best regards, CK
I can think of Three reasons
Close and reopen the excel file. Ensure that before you re-open there is no left over instance of Excel in task manager.
You are using On Error Resume Next
Incorrect Error Handling

Copy whole sheet to another VBA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm looking for a vba macro that copy whole data inside a sheet to another creating the new sheet. For example; I have a sheet called 14.11.2013 with some values.. clicking a button i need that the macro creates the new sheet and copy the entire datas from 14.11.2013 sheet to this one new. I'm a beginner in vba so i don't have much idea how can i do this kind of work. Someone can help me?
Of course when everything is copyed i want redirect in the new sheet.. I think something like:
Sheets("NewSheet").Activate
Here is the general format:
Sub CopySheet()
Dim s As Worksheet
Set s = Sheets("14.11.2013")
s.Copy after:=s
End Sub
If you are looking for some beginner tutorials i would recommend ExcelVBAIsFun on youtube.
I believe this video will help with how to record macros and teach yourself how to do some of the more simple things in Excel VBA. It also does something very similar to copying from one sheet to the other.
http://www.youtube.com/watch?v=HmAYKyurYNU&list=PLw8O1w0Hv2ztGjIkrW7suD6oNDaOk3vbR
I used this quite a bit while learning VBA myself.