Macro folders

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Macro folders

Post by LisaGreen »

Hi..

I'm after how to set up a macro file such as docm for each app for each office version.

Any help appreciated.

TIA
Lisa

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

Re: Macro folders

Post by HansV »

Your subject mentions folders, but the post itself mentions files. What exactly do you want?
Best wishes,
Hans

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

Re: Macro folders

Post by ChrisGreaves »

LisaGreen wrote:
01 Feb 2023, 11:22
I'm after how to set up a macro file such as docm for each app for each office version.
Hi Lisa.
What do you mean by (or why do you want) "each Office Version"?
I ask because, to the best of my knowledge, the VBA applications I have written in Office 2003, some of them migrated from Office 97, all still work in the the modern versions of Office.
Cheers, Chris
There's nothing heavier than an empty water bottle

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: Macro folders

Post by LisaGreen »

Hi Chris,

I'm in the middle of migrating from office 16 32 bit to 64, purely becauase it was free with a new laptop.. And my ""macros" don't work. there is apparently a different method being used that I have yet to get to grips with. After some googling and finding nothing solid about the way the different files should be "installed" it struck me that there doesn't appear to be a lot.. read almost nothing.. for office 2003 2007 2013 either. Soooo... I'd like to create a list of install ttechniques for docm type of files for those versions. I'm concentrating on macros essentially and not templates, which is a whole different story. This for excel word powerpoint outlook and access. I'm hoping that it comes down to a list of folders.. well.. one can always hope!!

Are you using templates rather than "macro enabled" files?

Great to see you are still up and running.. Hope all is good!!
Lisa

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

Re: Macro folders

Post by ChrisGreaves »

LisaGreen wrote:
01 Feb 2023, 15:31
Are you using templates rather than "macro enabled" files?
Hi Lisa.
I went through the migration to 64 bit about ten or more years ago and have forgotten what was involved.
I've just had a quick look through my utility library, and the term "Longptr" jumped out at me.
Reading through these search reults might pass on several clues.
https://eileenslounge.com/search.php?ke ... mit=Search

I have attached a module of declaratives which I imagine I had to make.
On top of that, here is the start of a procedure that uses ... something.

Code: Select all

Public Function strGetUNC(ByVal DriveLetter As String) As String
    '                   Ron Mittelman  Rmittelman@ Visto.com
    'Here 's a function that can convert a drive letter to a UNC path name.
    ' Public Declare  Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocationName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
    On Error Resume Next
    Dim sReturnVal As String
    ' 9073: "strGetUNC : generates "ByRef argument mis-matchafter PtrSafe additions"
#If VBA7 Then
    Dim lSize As Longptr
#Else
    Dim lSize As Long
#End If
    Dim lResult As Long
    strGetUNC = ""
    sReturnVal = Space$(255)
    lSize = Len(sReturnVal)
Obviously I have set up a compile-time variable "VBA7" somewhere that controls whether or not I want 64-bit declaratives.
Great to see you are still up and running.. Hope all is good!!
Not exactly running, but waiting for the electrician to arrive and break me of my habit of hard-wiring my baseboard heaters every time Muskrat Falls sends a surge down the power lines.
I am done shoveling drifting snow for the day, so I can get back to worrying about my workload ...

(later) this topic is where I started complaining :clapping:

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

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: Macro folders

Post by LisaGreen »

Thank you both Chria and Hans..

And I will continue looking as well!! LOL!!

Regards
Lisa

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

Re: Macro folders

Post by HansV »

Changes to the declaration of Windows API functions is one aspect of the change from 32-bit to 64-bit Office.

Another is that most or all ActiveX controls don't work in 64-bit Office.
Best wishes,
Hans

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

Re: Macro folders

Post by ChrisGreaves »

LisaGreen wrote:
01 Feb 2023, 15:31
... And my ""macros" don't work. ...
Hi Lisa; this sounds as if you have managed to identify a specific template with its collection of procedures, that "used to work" but "doesn't work anymore". And that suggests that you have a template that works on one machine that happens to be 32-bit, but not on second machine that happens to be 64-bit.

I am correct so far? Is there indeed one template that satisfies these conditions?
(If there are several such templates, then I'd suggest that you pick the one that is the simplest example).

You will probably be best served by working out exactly what needs to be done for that one template, get it working, then transport it to other machines/versions of Office before tackling the remainder of the set.

Cheers, Chris
There's nothing heavier than an empty water bottle

User avatar
Jay Freedman
Microsoft MVP
Posts: 1318
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Macro folders

Post by Jay Freedman »

Hi Lisa,

Chris's examples show some of the things you need to set up so that a macro can run on either 32-bit or 64-bit Office, depending on which bitness it finds installed at runtime. It has nothing to do with which folders the macros are in. There are two factors that have to be programmed for:
  • Which version gets called for any Windows API functions the macros call.
  • Whether the macros will use 32-bit pointers (declared as Long variables) or 64-bit pointers (declared as LongPtr). Also, VBA functions must be declared as PtrSafe.
I find the page at https://jkp-ads.com/Articles/apideclarations.asp extremely valuable for "translating" API calls.

The VBA7 compiler variable is automatically set by Office 64-bit programs; you don't define it yourself.

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: Macro folders

Post by LisaGreen »

Thank you everyone.. all good information but I'm still looking!

Regards
Lisa