|
Excel
Subs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table A - Overview |
|
|
|
|
|
|
|
|
|
|
# |
Title |
|
|
|
|
|
|
|
|
|
|
Line |
|
|
1 |
Export excel file
(specific sheets) to html |
|
|
|
|
|
38 |
|
|
2 |
Easy way to import XML
Script |
|
|
|
|
|
|
|
61 |
|
|
3 |
Macro to reduce to reduce
security setting (level) |
|
|
|
|
|
68 |
|
|
4 |
Find last line on sheet |
|
|
|
|
|
|
|
101 |
|
|
5 |
Various code parts (eg
like) |
|
|
|
|
|
|
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table B - (Code) Details |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
Details |
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Export excel file
(specific sheets) to html |
|
|
|
|
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sub ExportPublish() |
|
|
|
|
|
|
|
|
|
|
|
|
Dim FName As String |
|
|
|
|
|
|
|
|
|
Dim FPath As String |
|
|
|
|
|
|
|
|
|
Dim NewBook As Workbook |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FPath =
"\\xxxweb1\<department>$\Automation\Various" |
|
|
|
|
|
|
FName =
"Excel_Tips.html" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Create Newbook and copy
sheet [automation] |
|
|
|
|
|
|
|
Set NewBook =
Workbooks.Add |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Application.DisplayAlerts
= False |
|
|
|
|
|
|
|
|
ThisWorkbook.Sheets(Array("Subs",
"Functions", "Excel Formulas")).Copy
Before:=NewBook.Sheets(1) |
|
|
|
NewBook.Sheets("Sheet1").Delete |
|
|
|
|
|
|
|
|
NewBook.SaveAs
Filename:=FPath & "\" & FName, FileFormat:=xlHtml |
|
|
|
|
NewBook.Close |
|
|
|
|
|
|
|
|
|
|
Application.DisplayAlerts
= True |
|
|
|
|
|
|
|
|
End Sub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
Easy way to import XML
Script |
|
|
|
|
|
|
|
Top |
|
|
|
Sub ImportXML |
|
|
|
|
|
|
|
|
|
|
ActiveWorkbook.XmlImport URL:=FileName,
ImportMap:=Nothing, _ |
|
|
|
|
|
Overwrite:=True,
Destination:=Range("$A$1") |
|
|
|
|
|
|
End Sub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Macro to reduce to reduce
security setting (level) |
|
|
|
|
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sub ReduceSecurityLevel() |
|
|
|
|
|
|
|
|
|
|
|
Dim secAutomation As
MsoAutomationSecurity |
|
|
|
|
|
|
|
Dim zLevel As String |
|
|
|
|
|
|
|
|
|
Dim result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
secAutomation =
Application.AutomationSecurity |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' *** Example code on
changing level, do something, change level back *** |
|
|
|
|
If secAutomation <>
msoAutomationSecurityLow Then |
|
|
|
|
|
|
Select Case secAutomation |
|
|
|
|
|
|
|
|
|
Case msoAutomationSecurityLow:
zLevel = "Low"
'Level 1 |
|
|
|
|
|
Case msoAutomationSecurityByUI:
zLevel = "By UI"
'Level 2 |
|
|
|
|
|
Case
msoAutomationSecurityForceDisable: zLevel = "Disabled" 'Level 3 |
|
|
|
|
Case Else: zLevel =
"Unknown" |
|
|
|
|
|
|
|
|
End Select |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MsgBox "Current Level: " &
zLevel & " will be set to Low", vbOKOnly + vbInformation, _ |
|
|
|
"Macro Security Level" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Application.AutomationSecurity =
msoAutomationSecurityLow |
|
|
|
|
|
End If |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'Check for Calculation
settings |
|
|
|
|
|
|
|
|
|
If
Application.Calculation = xlCalculationManual Then |
|
|
|
|
|
|
result = MsgBox("Automatic Calculation
was off, this will be corrected", vbCritical, "Incorrect setting
Encountered") |
|
|
|
Application.Calculation =
xlCalculationAutomatic |
|
|
|
|
|
|
|
End If |
|
|
|
|
|
|
|
|
|
|
|
End Sub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Find last line on sheet |
|
|
|
|
|
|
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are various ways
and some methods are influenced by filters. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
….. |
|
|
|
|
|
|
|
|
|
|
|
Dim LastRow as long |
|
|
|
|
|
|
|
|
|
LastRow =
ActiveSheet.UsedRange.End(xlDown).row |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Various code parts (eg
like) |
|
|
|
|
|
|
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
changes the cell content to "contains string" if word
[string] excist in cell. |
|
|
|
|
|
|
If
(ActiveCell.Value Like
"*string*")
= True Then ActiveCell.Value = "contains string" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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