File association - what to do with *.BAS?

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

File association - what to do with *.BAS?

Post by ChrisGreaves »

Association.png
So I am searching my weekly USB backup drive Z: for a VBA code module that I have lost/forgotten/mislaid/deleted.
Piece of cake with Everything

Code: Select all

z:\hp15_077\Blotter\  dm:>2023-03-10 dm:<2023-03-28 files: ext:doc;dot;bas;txt
A likely candidate "N1.bas" shows up and I double-click on that file name and I choose Open With.
To my surprise Notepad.exe is not in the list.
So I "Choose an app on your PC" and browse to C:\Windows\System32\Notepad.exe and choose that.
"The program you selected cannot be associated with this file type. Please choose another program"

Question1 for Win11: Why am I not allowed to open a text file with a text editor application?
Question2 for Win11: What on earth has Notepad.exe done to earn this reputation as an Australian larrikin?

Nonetheless I am a meek and obedient Canadian, so I do as I am told and "choose another program".

Turns out that MSWord(2003) is a suitable candidate.
Question3 for Win11: Why am I allowed to open a text file, which happens to hold VBA code with a MSWord application?

OK, this third question is a bit of a stretch, and only a paranoid human brain would panic and leap to the conclusion that BAS PLUS MSWORD ==> malware.
'Tain't so!

Nonetheless, i am still licking my wounds.

Cheers, Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78437
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: File association - what to do with *.BAS?

Post by HansV »

You can use File > Import File... in the Visual Basic Editor in Word, Excel, PowerPoint, Outlook and Access to open a .bas file.

I have no problem opening a .bas file in Notepad on Windows 11...
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

HansV wrote:
28 Mar 2023, 11:38
I have no problem opening a .bas file in Notepad on Windows 11...
Thank you Hans.
When you say "Notepad", is it C:\Windows\System32\Notepad.exe?

I can't believe that I have tried so hard not to corrupt my young Win11 installation and it seems to be disintegrating before my eyes ...
Cheers, Chris
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78437
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: File association - what to do with *.BAS?

Post by HansV »

Notepad was already the first suggestion:

S2371.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

HansV wrote:
28 Mar 2023, 12:42
Notepad was already the first suggestion:
Thank you Hans. I asked about "is it C:\Windows\System32\Notepad.exe?" explicitly because I have several "notepad.exe" files on my system, and can't come up with a reason for them all being there.
Untitled2.png
The item highlighted in Yellow is the one I expect to be using.

For the past two weeks I have been having the Win11 pop-up message claiming that, essentially this isn't working, but I find that after I have tracked down the application, executed it once from Explorer, then the file association works in the future.
It is as if something is being unregistered, but that a direct execution re-registers it.

Next time it happens i shall post here with a PrtScr image AND a copy in text form, in case anyone else is searching for clues.

Cheers, Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78437
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: File association - what to do with *.BAS?

Post by HansV »

I have no idea which Notepad.exe is the one I'm running.
Best wishes,
Hans

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: File association - what to do with *.BAS?

Post by kdock »

Chris, given the error message, did you try to associate .bas with Notepad.exe? If so, could that be the problem?

Perhaps *.bas is inextricably associated with vba and Windows 11 just won't let you change it for that reason.

Did you try opening the bas file from Notepad?

:scratch: Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

JoeP
SilverLounger
Posts: 2069
Joined: 25 Jan 2010, 02:12

Re: File association - what to do with *.BAS?

Post by JoeP »

@Chris, I would think that with a Win+R if you type Notepad you would execute the one that matches the current "new" icon for Notepad. The one that is 934KB. That is the version from the Microsoft Store which is where Notepad comes from now.
Joe

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

kdock wrote:
29 Mar 2023, 14:24
Chris, given the error message, did you try to associate .bas with Notepad.exe? If so, could that be the problem?
Perhaps *.bas is inextricably associated with vba and Windows 11 just won't let you change it for that reason.
Did you try opening the bas file from Notepad?
Hi Kim. I've been ignoring you because this Topic slipped through my procedures for dealing with response! :grin:

Today, May 8th, when I export a VBA module to a BAS file then execute that BAS file from Windows Explorer, the file is opened in Win11 Notepad. Exactly as I expect!

I suspect that I have a System Restore Point that has preserved a corrupted state of the registry.

Behaviour: I execute a TXT, BAS, or PNG or JPG file and Win11 says something like "I cannot open this file". I choose "Open With" and select Notepad or MSPaint respectively, the file opens, and the next time I execute a text or image file, the file is opened immediately in the correct application.

I note that these two basic Windows applications were rewritten for Win11, so maybe there is a new association setting in the registry that either is not being fully set up, or is vulnerable from some other activity on my system.
Cheers, Chris
There's nothing heavier than an empty water bottle

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

JoeP wrote:
29 Mar 2023, 15:46
@Chris, I would think that with a Win+R if you type Notepad you would execute the one that matches the current "new" icon for Notepad. The one that is 934KB. That is the version from the Microsoft Store which is where Notepad comes from now.
Hi JoeP. "Hi Kim. I've been ignoring you because this Topic slipped through my procedures for dealing with response! :grin:" you and Kim both!!"
Untitled.png
"What", we may ask, "am I doing with twenty instances of "Notepad.exe" on my new (March 15th) Win11 system?"
FWIW I do not knowingly obtain software from the Microsoft store.
The attached image suggests that the first instance of Notepad.exe in the list is the one I want, based on your Size qualification.

The four yellow-outlined instances appear to have been neutered by something or other.
I think that these yellow items can be deleted safely.

The four purple-outlined items look as if they are older versions of Notepad.exe. I remember looking for Notepad.exe on a backup drive. Perhaps i copied them across in case I could use a familiar version.
I think that these purple-items can be deleted safely.

The five orange-outlined instances are Prefetch.
I think that these orange-items can be deleted safely. But they will return like Aspen tree shoots after the lawn has been mowed.

The three blue-outlined items are Multilingual User Interface file, and much as I like languages, i can probably live without Spanish, French, or Italian in Notepad.exe.
I think that these blue-items can be deleted safely. But I run the risk of upsetting a critical balance in Win11

Summary: I should delete the yellow and purple items and create a new Restore Point.

Would you agree (although I won't blame you if Win11 collapses! :grin: )
Cheers, Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78437
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: File association - what to do with *.BAS?

Post by HansV »

I wouldn't mess with this! Leave all of them alone, they take up very little space, and you don't know their function.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

HansV wrote:
08 May 2023, 13:53
...and you don't know their function.
Hi Hans. True it is that they take up little space, but space is not the problem.
The problem is that on three or more occasions since I installed Win 11 the hurdle arises where I can't execute TXT (or BAS) or PNG or JPG files.
And while I do not know if these spurious examples of Notepad.exe cause the problem, I do not know if these Notepad.exe do NOT cause cause the problem.

With the lightning speed of my SSD it is little bother to create a Restore Point, delete the two groups of Notepad.exe, and run for a day or two and see what happens.
Cheers, Chris
There's nothing heavier than an empty water bottle

JoeP
SilverLounger
Posts: 2069
Joined: 25 Jan 2010, 02:12

Re: File association - what to do with *.BAS?

Post by JoeP »

Why don't you use Settings | Apps | Default apps to set Notepad or whatever app you wish as the default for those file types?
Joe

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15590
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: File association - what to do with *.BAS?

Post by ChrisGreaves »

JoeP wrote:
08 May 2023, 21:42
Why don't you use Settings | Apps | Default apps to set Notepad or whatever app you wish as the default for those file types?
Hi Joe
Short Answer: Because I've never had to do that before!
Long Answer: Since 1990 Windows has always associated Notepad with TXT, and since 1997 associated Notepad with BAS. Only since March 15th this year has the association failed.

I took your suggestion and looked in Default Apps and yes, there are a couple of dozen of them, spaced out so as not to be visible on a single screen, so I took no snapshot; but I am sure that you have seen them all.
I scrolled down enough to see BAS and TXT and they were there. So the next time this hiccough occurs I shall check that they are still there, or not.
Thanks again, Chris
There's nothing heavier than an empty water bottle