Call VBA-Subs From Old XLM-Macros

  • Thread starter Thread starter hglamy
  • Start date Start date
H

hglamy

Hello there,

how can I refer to vba-code from an xlm-macrosheet ?

Thank you in advance,

Kind regards,

H.G. Lamy
 
Hi,

Try the following. I've migrated some old systems with
similar code.

In the macro code on the Macro Sheet:
=RUN("FileName.XLM!ProtectSh",FALSE)
or (Both .xlm and .xls file extensions work)
=RUN("FileName.XLS!ProtectSh",FALSE)

where FileName is the name of the file with the VBA code

The 4.0 macro and VBA code can be in the same file, but
need not be.


The VBA code in the file with the called routine:
'*** PROTECT THE ACTIVE SHEET - NO PW ***
Sub ProtectSh()
ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Best Regards,
Walt
 
Thank you Walt !

Regards,

H.G. Lamy

Walt Weber said:
Hi,

Try the following. I've migrated some old systems with
similar code.

In the macro code on the Macro Sheet:
=RUN("FileName.XLM!ProtectSh",FALSE)
or (Both .xlm and .xls file extensions work)
=RUN("FileName.XLS!ProtectSh",FALSE)

where FileName is the name of the file with the VBA code

The 4.0 macro and VBA code can be in the same file, but
need not be.


The VBA code in the file with the called routine:
'*** PROTECT THE ACTIVE SHEET - NO PW ***
Sub ProtectSh()
ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Best Regards,
Walt
 
Back
Top