objShell.Run changes with Windows 10 v1909 [closed] - vba

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"""

Related

System.NullReferenceException Epplus Opening Worksheet [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 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!

Vb.Net Startup Determination [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 7 years ago.
Improve this question
Hello everyone i'll keep it short and simple.
I want the app to determine if the current app (which is called "Managment") is on startup. If it is on the startup then do nothing.. if it isnt there put it on startup.
What is wrong with this? And is there any way without admin rights?
Dim app As String = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).GetValue("Management")
If app = Nothing Then
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)
End If
As mentioned in my comment, you are looking in the wrong place.
Using subKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
If subKey.GetValue("Management") <> Nothing Then
'It's there on start-up
Else
'Just add the key....
End If
End Using

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

Form disappears when trying to create a shortcut VB.NET [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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.
Closed 9 years ago.
Improve this question
When my code reaches the Dim MyShortcut... line the form disappears, no exception no windows error reporting the form just vanishes with the process still running.
Friend Sub CreateShortcut(Location As String, Target As String)
Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut = CType((New IWshRuntimeLibrary.WshShellClass).CreateShortcut(Location), IWshRuntimeLibrary.IWshShortcut)
MyShortcut.TargetPath = Target
MyShortcut.Save()
End Sub
Please ask if you need any more details. I wasn't sure what could be causing the issue so didn't know what else to add.
Thanks in advance!!

Wix Conditional Statement [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 9 years ago.
Improve this question
I have the following WIX Condition that doesn't seem to behaving like I expect
REMOVE = "ALL" OR USERNAME <> ""
I want my custom action to run if it is an uninstall
REMOVE = "ALL"
Or if the user has entered a username
USERNAME <> ""
I am performing a "change" installation option and the condition is coming back as false even though I am entering a username?
UPDATE: I am doing this check inside a merge module. The USERNAME property gets set inside the UI which is part of the Main Wix Installer. Don't know if this makes a difference.