Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
204 views

Creating CMMS Electronic System Using Excel VBA: July 2020

This document describes creating a computerized maintenance management system (CMMS) using Microsoft Excel and Visual Basic for Applications (VBA). It includes: 1) Designing a system with folders to store work orders, job plans, and a preventive maintenance module. 2) Converting the Excel file to allow VBA coding by enabling the developer tab. 3) Adding a button and writing code to generate preventive maintenance work orders on a schedule and send them to responsible parties.

Uploaded by

Rafael Tejeda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
204 views

Creating CMMS Electronic System Using Excel VBA: July 2020

This document describes creating a computerized maintenance management system (CMMS) using Microsoft Excel and Visual Basic for Applications (VBA). It includes: 1) Designing a system with folders to store work orders, job plans, and a preventive maintenance module. 2) Converting the Excel file to allow VBA coding by enabling the developer tab. 3) Adding a button and writing code to generate preventive maintenance work orders on a schedule and send them to responsible parties.

Uploaded by

Rafael Tejeda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/342656451

Creating CMMS electronic system Using Excel VBA

Article · July 2020

CITATIONS READS
0 3,111

1 author:

Ayman Khoshouey
Gulf of Suez Petroleum Company
6 PUBLICATIONS   0 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Simplify Business work using available software View project

All content following this page was uploaded by Ayman Khoshouey on 03 July 2020.

The user has requested enhancement of the downloaded file.


GULF OF SUEZ PETROLIUM COMPANY, MAINTENANCE ENGINEERING, MAXIMO DEPARTEMENT, 8 APRIL, 2019

Creating CMMS electronic system Using Excel VBA


Ayman Elsaid Abdelwahed Khoshouey
Gulf Of Suez Petroleum Company
Maintenance engineering division
Ras Shoukair, Red Sea, Egypt
*Contact: khoshoueyae@gupco.net, phone +201018002225

PM Module create a new work order with all data and send
the link of the generated work order Excel file to the
Abstract— A CMMS is computer software designed to simplify responsibility person[s].And change the related dates to the
maintenance management.CMMS stands for Computerized next frequency wave.
Maintenance Management System (or Software) and is The build of the PM module is very esy and can be modified
sometimes referred to as Enterprise Asset Management (EAM) easly
software. To better understand what a CMMS is, we will break
the term down into each individual component.

Introduction
In the beginning, we will design a system using Microsoft
Excel contains of some files and folders:

Fig. 2 the PM module structure

I. CONVERTING STEPS
To allow adding codes to the Microsoft Excel. You must
enable the VBA (Visual Basic for Applications) developer tab.

a) Open Microsoft Excel workbook.


b) Click [File] from main menu.
c) Then click [Options].
d) Click [Customize Ribbon].
e) Check [Developer] checkbox.

Fig. 1 the application folders and files structure

a) The first folder is for list the CM [Corrective


Maintenance] work orders.
b) The second folder is for contains the JP [Job Plans].
c) The third folder is for contains PM [Preventive
Maintenance] Module.
d) The last folder is for contains list of PM [Preventive
Maintenance] work orders.

The main idea Fig. 3 Adding [Developer] tab to worksheet


The main idea of the application is timing the generation of
the work orders during 24 hours every day by checking is the
reported date equal to today or not. If the result is true the The next step is adding a new button to the workbook and
editing code of it:
GULF OF SUEZ PETROLIUM COMPANY, MAINTENANCE ENGINEERING, MAXIMO DEPARTEMENT, 8 APRIL, 2019

A. Adding button GeneratPMWO


DoShowMesseage
1) Click developer tab.
2) Click insert. End Sub
3) Button icon.[Right click to rename]

In the new developed system:


a)First create timing Procedure.

II. GENERATE WORK ORDER CODE


Sub GeneratPMWO()

'--------------------------------------Generate PM Work Orders

Set MyRange = ThisWorkbook.Sheets("Main").Range("F"


& "1")
LastRow = Cells(Rows.Count,
MyRange.Column).End(xlUp).Row
Code:
Option Explicit For i = 3 To LastRow
Dim THandle As Long If ThisWorkbook.Sheets("Main").Cells(i, 6).Value =
Private Declare Function BringWindowToTop "Active" Then
Lib "user32" (ByVal _ ThisWorkbook.Sheets("Admin").Cells(2, 8).Value =
Hwnd As Long) As Long ThisWorkbook.Sheets("Admin").Cells(2, 8).Value + 1
Private Declare Function FindWindow Lib 'ThisWorkbook.Sheets("Main").Cells(1, 5).Value =
"user32" Alias _ ThisWorkbook.Sheets("Admin").Cells(2, 6).Value
"FindWindowA" (ByVal lpClassName As Any, currentWO = ThisWorkbook.Sheets("Admin").Cells(2,
ByVal lpWindowName _ 8).Value
As Any) As Long currentJP = Cells(i, 5).Value
Const sinterval = "23:59:59" '"00:01:00" '"23:59:59" currentPM = Cells(i, 1).Value
Const DateFmt = "yy mm dd hh mm ss" currentLOCATION = Cells(i, 7).Value
Dim WO_Number As String currentCondOfWork = Cells(i, 8).Value
Dim DestinWS As Worksheet currentReason = Cells(i, 9).Value
Dim currentWO As String currentResponsibility = Cells(i, 10).Value
Dim currentJP As String TargetStartDate = Cells(i, 4).Value
Dim currentPM As String
Dim currentLOCATION As String CopyWorkbook
Dim currentCondOfWork As String End If
Dim currentReason As String Next
Dim currentResponsibility As String
Dim TargetStartDate As Date Application.DisplayAlerts = True
Dim GeneratedWO As String MsgBox GeneratedWO, vbOKOnly, "List Of Generated
Dim LastRow As Integer Work Orders"
If ThisWorkbook.Worksheets(1).Shapes("Check
Box 9").OLEFormat.Object.Value = 1 Then
DoShowMesseage Dim iret As Long
End If
End Sub THandle = FindWindow(vbEmpty, "PM_" & currentWO &
" - Excel")
Sub DoShowMesseage() iret = BringWindowToTop(THandle)

Application.OnTime Now() + TimeValue(sinterval),


"DoAction" End Sub
End Sub

Sub DoAction()
'i = i + 1
'MsgBox "Time value in mints= " & i
GULF OF SUEZ PETROLIUM COMPANY, MAINTENANCE ENGINEERING, MAXIMO DEPARTEMENT, 8 APRIL, 2019

Year = Format(Now, "yyyy")


pdfName = Year & "-" & "PUR" & "-" & DIV & "-" &
B. Send the document by mail to responsibility person[s] PURnum
Creating sub program to send the document by mail.
Code: ChDir ActiveWorkbook.Path & "\PDF_Files"
Sub Send_MailTo_MGR() fileSaveName = currentYear & "-" & "PUR" & "-" &
Dim objOutlook As Object currentDIV & "-" & currentPURnum 'ActiveSheet.Name
Dim objMail As Object
Set objOutlook = CreateObject("Outlook.Application") ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF,
Set objMail = objOutlook.CreateItem(0) Filename:= _
With objMail fileSaveName _
.To = "MGR_name@company.com" , Quality:=xlQualityStandard,
.Subject = "(Report Number") Need Approval" IncludeDocProperties:=True, IgnorePrintAreas _
.cc = "secretariat@company.com" :=False, OpenAfterPublish:=True
.HTMLBody = "<font size=""3"" face=""Calibri"">" &
"Dear MGR,<br><br>" & _ MsgBox "The file saved---->" & "\PDF_Files\" &
"Informed that " & ActiveWorkbook.Name & " has fileSaveName & ".PDF", vbOKOnly, "Success saving....."
been raised.<br><B>" & _
"This now requires your approve :<br><B>" & _ End Sub
"Click on this link to access the report form: " & _
"<A HREF=""file://" & ActiveWorkbook.FullName D. Links to my published developed project
&_ https://www.udemy.com/creating-electronic-signature-
""">Link to the file</A>" & _ system-using-excel-vba/
"<br><br>For Software Help please contact:" & _
"<br><br>Name Last Name Ext: Mobile:+# </font>" References
.Send  Excel VBA Macro Programming by Richard Shepherd [1]
End With  VBA and Macros for Microsoft Excel (Business Solutions) by Bill Jelen
Set objOutlook = Nothing and Tracy Syrstad [2]
Set objMail = Nothing  Office VBA Macros You Can Use Today by Juan Pablo Gonzalez, Cindy
End Sub Meister, Suat Ozgur, Bill Dilworth. [3]
 VBA and Macros: Microsoft Excel 2010 (Mrexcel Library) by Bill Jelen,
C. Save the electronic document as [PDF] format Tracy Syrstad [4]
Fig. 6 PDF format of the sample document  Writing Excel Macros With VBA by Steven Roman [5]
 Excel Macros for Dummies by Michael Alexander [6]
Code:
Sub Save_As_PDF() III. CONCLUSIONS
Dim pdfName As String This paper is a sample of how to use Microsoft Excel to
Dim fileSaveName As String developed complete applications using little code lines you can
PURnum = ActiveWorkbook.Sheets("WorkFlow").Cells(1, find more details of these methods in the website
1).Value (www.binarycodesoft.com)
DIV = ActiveWorkbook.Sheets("WorkFlow").Cells(3,
1).Value

View publication stats

You might also like