VBA Shell no longer working in Windows 11 - vba

I recently updated to Windows 11 and I notice that the Shell call does not longer open the Notepad.
It seems that Windows 11 now has notepad in the "C:\Windows" directory as well as the "C:\Windows\System32" directory but when I run this command using either, it no longer opens the notepad, it just runs and nothing happens
Dim x As Variant
x = Shell("C:\Windows\system32\notepad.exe ""C:\test.txt""")
Is anyone else experiencing this behavior or found a way around it?

Adding vbNormalFocus did the trick. Thank you David

Related

How do I get my neovim settings to work properly and actually save

I just installed nvim for the first time, this is also my first time using a terminal based code editor, and I'm migrating from VSCode (ik it's going to be hard),
and now I'm configuring it, I'm following this tutorial:
https://www.youtube.com/watch?v=vdn_pKJUda8&t=347s&ab_channel=JoseanMartinez
And when put the code in the options.lua file, it does not do anything, for example, the
opt.relativenumber = true
is not doing anything
I have tried running commands to change settings, and that has worked, for example
:set relativenumber
But as soon as I exit the file and open a new one, it just breaks again
I have tried simply copy and pasting the code, restarting nvim, switching terminal emulators, etc.
It's really annoying because I am trying to get rid of this stupid feature where it continues comments to the next line and I have to run like 50 commands every time I open a new file just so I can edit it the way I want
My .config file is in
C:\Users\brady\.config
and my nvim.exe file is in
C:\Users\brady\nvim-win64\bin
I am on Windows 10 and my terminal emulator is called 'Tabby'
I figured it out! All the tutorials I am watching are on Linux, but I am on Windows. So instead of putting the nvim folder in my .config, I am supposed to put it in C:\Users\brady\AppData\Local
Are you sure that you're adding your nvim-config file in the correct directory? I'd assume that you need to add your init.vim into C:\Users\brady\.config\nvim\init.vim.
Maybe this answer helps you.

Error 76 - path not found, using FileSystemObject.GetFolder() with SharePoint address

What could be going on here?
I'm using:
Dim FOL As folder
Dim fs As New FileSystemObject
Set FOL = fs.GetFolder("//mycompany.sharepoint.com/etc/etc/")
And on my laptop it's working perfectly.
Last week, it worked on my colleague's laptop perfectly. This week, it works on mine but it doesn't work on my colleague's! It gives a run-time 76 : 'Path not found' error.
We've both tried pasting the link directly in to an IE browser and it connects fine. So what could have changed between last week and this week to make it stop working on my colleagues' yet still work OK on mine?
One additional piece of info: On my browser in SharePoint I have the option to "Open with Windows Explorer" but my colleague doesn't.
EDIT: I believe my question is different to the similar here because this WAS working and now it wasn't. I'm asking what could have changed and is it linked to the lack of Action "Open with Windows Explorer".
You could map the SharePoint folder to a drive letter.
This solution is discussed here:
Get the content of a sharepoint folder with Excel VBA

Outlook 2013 'Run a script' rule has disappeared

I have some rules for work in outlook 2013 - however following my laptop crashing the other day, I can no longer run any rules, they simply do not work (I don't even get a debug notification). Upon checking my macros, I found that when I tried to click on any scripts I have and I keep getting the message 'This action is not available in the current mode'.
The option to create a new script has disappeared from the rule list too.
So far I have tried:
-Using the outlook 2016 fix by running the registry fix DWORD 1 (There is nothing out there for 2013). I have restarted my Pc and it still has not changed a thing.
-System restore to a previous date. This has literally changed nothing.
I'm a little stuck. I have attached screenshots to further explain exactly what I am experiencing.
Thanks,
Rachael
Some information has been whited out due to confidentiality.
Trust Centre Settings:
I encountered this issue after a Windows Update. Here's what fixed it for me:
Save everything below the line as a .reg file and then double-click it to run and launch (or manually add it your registry via regedit).
You should probably backup your registry first to be safe and please note that this was the correct location for my Office 2013 installation (yours may be different).
Office 2013 = 15.0
Office 2016 = 16.0
Save using Notepad as a .reg file to double-click and upload to your system's registry (Office 2013). I hope this helps someone else! -Mike
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Security]
"EnableUnsafeClientMailRules"=dword:00000001
here is a quick and dirty test to check whether vba code runs at all when email arrives
put it into "ThisOutLookSession" which is under "Microsoft Office Outlook Objects"
then send yourself an email ... if vba runs then you should see a popup
it will not solve your problem, but it will provide more info to help narrow down the cause
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
MsgBox "you have mail"
End Sub
Or you can create .reg file Open Notepad and save-as .reg
Outlook 2010
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\14.0\Outlook\Security]
"EnableUnsafeClientMailRules"=dword:00000001
For Outlook 2013 use \Office\15.0\ and Outlook 2016 \Office\16.0\

Visual Basic Running external .exe issue

I am currently working on a project and have found that using the Process.Start and shell commands to run other existing programs is being problematic. What happens is that when I click the button in my program to launch the other exe file it loads the program but not correctly, iv seen this behavior in two external programs of mine one fails to update when run through my program but on its own works fine the other fails to load up the interface correctly and gives me an error.
The error tells me it cant find the resources it relies on to function so can anyone tell me why it does this and a possible solution as iv tried all the startup codes I know: Start, Process.Start and shell?
EDIT
I also found that if I place my exe in the same folder as the program I want to run it works fine but this is not suitable for my project so any workarounds?
Solution:
Thanks for all your help I needed to set the working directory, beginners mistake :)
Dim filePath As String = "C:\Program Files\Example\Example.exe"
Dim psi As New ProcessStartInfo(filePath)
psi.WorkingDirectory = IO.Path.GetDirectoryName(filePath) Process.Start(psi)
You have to define a WorkingDirectory
var proc = new System.Diagnostics.Process();
proc.StartInfo.WorkingDirectory = "The Location of the process";
proc.Start("the process");

Windows XP Excel VBA Crashes on Windows 7

I am trying to switch a Excel VBA macro from Windows XP to Windows 7. Both of the Windows versions are 32-bit operating systems. My Windows 7 version is Enterprise edition.
The VBA code works fine on Windows XP. When I have tried to run the code on Windows 7, it crashes and reports no error description.
I have registered msinet.ocx, which appears to be required for Microsoft Internet Transfer Control 6.0. I have also tried to fix security issues by adding the additional com components tabctl32, comctl332/232/32 and comdlg32, all of which are ocx files. However, nothing changes - my code still fails on Windows 7.
Once msinet was unregistered, Excel VBA opens my Workbook, reports the missing reference msinet and does not work at all. How do I resolve this issue?
Awkward. Open the sheet in an Excel session with Macro Security set to high or medium, and reply 'No' to the dialogue about enabling VBA macros in the sheet.
If it opens, you should still be able to view the project, and this might show an obvious missing reference or an error if you attempt to compile it.
Next: save the workbook as html and close Excel. Clear the temp folder, restart excel, open the html file and save it back into Excel format. If you're lucky, all the legacy objects and references will be cleared out and replaced by versions compatible with your new OS.
This works about half the time.
The system not crashing when msinet.ocx is not registered doesnt necessary means that it is the problem.
If you have a call to that library (msinet.ocx) in any procedure inside of or called from the ThisWorkbook module and you have that library unregistered, then when the file opens and tries to run the On open macro the module will not compile and therefore wont run the line of code that makes it crash. (I am only guessing that this might be your case.)
Try to find out which exact call makes your system crash.
Let msinet.ocx registered.
Open the file without activating the macros.
Then manually run Step by Step (F8) through the opening code of your file ( Private Sub Workbook_Open() )
Eventually you will reach the exact line of code that makes your system crash. Whit that information you will be able to get more help.
NOTE:
To open the file without activating the macros you can use one of the following methods:
Press and keep pressed the Shift key after you doubleclicked on the file to open it(from the windows explorer). For this method to work, the Excel application must be clossed.
If the Excel application is open, then go to the VB editor and type application.EnableEvents=False in the immediate window (and press enter to run it). Just be aware that this will disable the events on every file in that instance of Excel. You will have to set it back to true or close the application (not just the file).
Check if you don't have references to missing libraries, if so simply uncheck it. I had a similar problem and it helped in my case.