0% found this document useful (0 votes)
4 views1 page

Grasp

The document outlines a VBA script for generating reports in PDF or Word format from a Word document. It includes error handling, functions for adding report sections, and retrieving project and model information. The report contains details such as project name, client, engineer, and a summary of model components.

Uploaded by

Le Fondateur
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)
4 views1 page

Grasp

The document outlines a VBA script for generating reports in PDF or Word format from a Word document. It includes error handling, functions for adding report sections, and retrieving project and model information. The report contains details such as project name, client, engineer, and a summary of model components.

Uploaded by

Le Fondateur
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/ 1

Case "PDF"

wordDoc.ExportAsFixedFormat reportPath & ".pdf", 17 ' 17 = PDF


wordDoc.Close False
wordApp.Quit
MsgBox "PDF report generated successfully", vbInformation,
"GRASP"
Case Else
wordDoc.SaveAs2 reportPath & ".docx"
MsgBox "Word report generated (unknown format requested)",
vbInformation, "GRASP"
End Select

Exit Sub

ErrorHandler:
MsgBox "Error generating report: " & Err.Description, vbCritical, "GRASP
Error"
On Error Resume Next
wordDoc.Close False
wordApp.Quit
End Sub

' Add section to report


Sub AddReportSection(wordDoc As Object, title As String, content As String)
With wordDoc.Content
.InsertAfter title & vbCrLf
.InsertAfter content & vbCrLf & vbCrLf
.Paragraphs(.Paragraphs.Count - 1).Range.Font.Bold = True
.Paragraphs(.Paragraphs.Count - 1).Range.Font.Size = 14
End With
End Sub

' Get project information


Function GetProjectInfo() As String
Dim info As String
info = "Project Name: " & ThisWorkbook.Worksheets("Project
Info").Range("B1").Value & vbCrLf
info = info & "Client: " & ThisWorkbook.Worksheets("Project
Info").Range("B2").Value & vbCrLf
info = info & "Engineer: " & ThisWorkbook.Worksheets("Project
Info").Range("B3").Value & vbCrLf
info = info & "Date: " & Format(Date, "yyyy-mm-dd") & vbCrLf
info = info & "Software: GRASP v2.0" & vbCrLf
GetProjectInfo = info
End Function

' Get model summary


Function GetModelSummary() As String
Dim summary As String
summary = "Nodes: " & NodeList.Count & vbCrLf
summary = summary & "Members: " & MemberList.Count & vbCrLf
summary = summary & "Plates: " & PlateList.Count & vbCrLf
summary = summary & "Materials: " & MaterialList.Count & vbCrLf
summary = summary & "Sections: " & SectionList.Count & vbCrLf
summary = summary & "Load Cases: " & LoadCaseList.Count & vbCrLf & vbCrLf

' Add model image

P a g e 53 | 57

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy