Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default URG: Saving an e-mail to be digitally signed

Okay, I have read through several examples and discussions about digitally
signing an excel workbook/code is not easy. My question deals with a mixture
of Excel and Outlook. I don't need to sign the Excel file, but I do need to
digitally sign the e-mail that is generated from within one of many Excel VBA
macros. I'm not sure if this action requires an additional "Add-in" or other
typically installed component to be "selected" or not.

An alternative would be to simply save the e-mail into the users Draft
folder or similar to allow the user to "forward" the message and apply the
appropriate Digital Signature. In order to meet the requirements posed I can
not first send the e-mail to the user and then let them forward and apply the
digital signature.
  #2   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default URG: Saving an e-mail to be digitally signed

One problem I have with the code below in comparison to that required of me,
is that when I create NewBook (though it is only created in memory) it does
not take on the name that I want. The desire is that when the workbook is
sent to the user that the workbook filename meets the requirements I must
meet. I have determined that I could first save the workbook with the
desired name, but that would require me to delete it again or risk building
up a long list of unnecessary files.

The code that does the work that I have is as follows in a module called
'Email'. Elsewhere within the module the private subroutine EmailIndividual
is called, so that would be the "starting point" for the purpose of this
conversation:

Option Explicit

Dim NewBook As Workbook
Dim NewSheet As Worksheet

Private Sub CreateFile(IndName As String)
Dim FilePath As String
'Dim NewBook As Workbook

Application.StatusBar = "Opening the Workbook..."

Set NewBook = Workbooks.Add(xlWBATWorksheet)

With NewBook
.Title = IndName
.Subject = IndName
.Sheets(1).Name = IndName
With .Sheets(1).PageSetup
'Work is performed here to format the display of data, page
setup, Margins, Print Range, Print Range setup, headers, and footers.

End With
.Saved = True

End With

Set NewSheet = NewBook.Sheets(1)
NewBook.Activate

Application.StatusBar = False

End Sub

Private Sub EmailIndividual(Individual As IndReportCls)
Dim intI As Integer
Dim IndName As String
Dim Location As Long

Application.ScreenUpdating = False

'Make the file
Call CreateFile(Individual.GetColData(MthRepVars.GetNam e_Col))
'Create the copy page from those things to be emailed
CopySheet.Cells.Delete 'CopySheet is a worksheet that is hidden from the
user that receives data that can be copied for sending information particular
to the individual.
MonthReport.InsertHeader 'MonthReport is a module, and InsertHeader
inserts the desired header to the active worksheet.

Call Individual.SetEmailed(True) 'Individual is a class object that
supports a boolean variable to track whether the individual has been e-mailed
or not.

For intI = 1 To MonthReport.GetLastColumn
CopySheet.Cells(MonthReport.GetDataStart, intI).Value =
Individual.GetColData(intI) ' This portion of code copies the headers that
should appear in the e-mailed version of the data.
Next intI
Call Individual.SetEmailed(False)

MonthReport.InsertFooter
'Copy the page
CopySheet.Cells.Copy
NewSheet.Cells.PasteSpecial xlPasteAll

'Email them
NewBook.HasRoutingSlip = True

'Ensure the name has no unnecessary periods, so that the mail server can
handle it.
IndName = Individual.GetColData(MthRepVars.GetName_Col)
While InStr(IndName, ".") 0
Location = InStr(IndName, ".")
If Location = 1 Then
IndName = Right(IndName, Len(IndName) - Location)
ElseIf Location = Len(IndName) Then
IndName = Left(IndName, Location - 1)
Else
IndName = Left(IndName, Location - 1) + Right(IndName,
Len(IndName) - Location)
End If
Wend

On Error GoTo ErrorMailing
With NewBook.RoutingSlip
.Delivery = xlAllAtOnce
.Recipients = IndName
'.Recipients = Array(IndName)
.ReturnWhenDone = False
.Subject = "[Subject Text Desired]"
.Message = "[Message that explains what this e-mail is about]"
End With
NewBook.Route
Call Individual.SetEmailed(True)

ErrorMailing:
NewBook.HasRoutingSlip = False
Err.Clear
On Error GoTo 0
NewBook.Saved = True
NewBook.Close

Application.ScreenUpdating = True
End Sub

"GB" wrote:

Okay, I have read through several examples and discussions about digitally
signing an excel workbook/code is not easy. My question deals with a mixture
of Excel and Outlook. I don't need to sign the Excel file, but I do need to
digitally sign the e-mail that is generated from within one of many Excel VBA
macros. I'm not sure if this action requires an additional "Add-in" or other
typically installed component to be "selected" or not.

An alternative would be to simply save the e-mail into the users Draft
folder or similar to allow the user to "forward" the message and apply the
appropriate Digital Signature. In order to meet the requirements posed I can
not first send the e-mail to the user and then let them forward and apply the
digital signature.

  #3   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default URG: Saving an e-mail to be digitally signed

Anyone?!

"GB" wrote:

One problem I have with the code below in comparison to that required of me,
is that when I create NewBook (though it is only created in memory) it does
not take on the name that I want. The desire is that when the workbook is
sent to the user that the workbook filename meets the requirements I must
meet. I have determined that I could first save the workbook with the
desired name, but that would require me to delete it again or risk building
up a long list of unnecessary files.

The code that does the work that I have is as follows in a module called
'Email'. Elsewhere within the module the private subroutine EmailIndividual
is called, so that would be the "starting point" for the purpose of this
conversation:

Option Explicit

Dim NewBook As Workbook
Dim NewSheet As Worksheet

Private Sub CreateFile(IndName As String)
Dim FilePath As String
'Dim NewBook As Workbook

Application.StatusBar = "Opening the Workbook..."

Set NewBook = Workbooks.Add(xlWBATWorksheet)

With NewBook
.Title = IndName
.Subject = IndName
.Sheets(1).Name = IndName
With .Sheets(1).PageSetup
'Work is performed here to format the display of data, page
setup, Margins, Print Range, Print Range setup, headers, and footers.

End With
.Saved = True

End With

Set NewSheet = NewBook.Sheets(1)
NewBook.Activate

Application.StatusBar = False

End Sub

Private Sub EmailIndividual(Individual As IndReportCls)
Dim intI As Integer
Dim IndName As String
Dim Location As Long

Application.ScreenUpdating = False

'Make the file
Call CreateFile(Individual.GetColData(MthRepVars.GetNam e_Col))
'Create the copy page from those things to be emailed
CopySheet.Cells.Delete 'CopySheet is a worksheet that is hidden from the
user that receives data that can be copied for sending information particular
to the individual.
MonthReport.InsertHeader 'MonthReport is a module, and InsertHeader
inserts the desired header to the active worksheet.

Call Individual.SetEmailed(True) 'Individual is a class object that
supports a boolean variable to track whether the individual has been e-mailed
or not.

For intI = 1 To MonthReport.GetLastColumn
CopySheet.Cells(MonthReport.GetDataStart, intI).Value =
Individual.GetColData(intI) ' This portion of code copies the headers that
should appear in the e-mailed version of the data.
Next intI
Call Individual.SetEmailed(False)

MonthReport.InsertFooter
'Copy the page
CopySheet.Cells.Copy
NewSheet.Cells.PasteSpecial xlPasteAll

'Email them
NewBook.HasRoutingSlip = True

'Ensure the name has no unnecessary periods, so that the mail server can
handle it.
IndName = Individual.GetColData(MthRepVars.GetName_Col)
While InStr(IndName, ".") 0
Location = InStr(IndName, ".")
If Location = 1 Then
IndName = Right(IndName, Len(IndName) - Location)
ElseIf Location = Len(IndName) Then
IndName = Left(IndName, Location - 1)
Else
IndName = Left(IndName, Location - 1) + Right(IndName,
Len(IndName) - Location)
End If
Wend

On Error GoTo ErrorMailing
With NewBook.RoutingSlip
.Delivery = xlAllAtOnce
.Recipients = IndName
'.Recipients = Array(IndName)
.ReturnWhenDone = False
.Subject = "[Subject Text Desired]"
.Message = "[Message that explains what this e-mail is about]"
End With
NewBook.Route
Call Individual.SetEmailed(True)

ErrorMailing:
NewBook.HasRoutingSlip = False
Err.Clear
On Error GoTo 0
NewBook.Saved = True
NewBook.Close

Application.ScreenUpdating = True
End Sub

"GB" wrote:

Okay, I have read through several examples and discussions about digitally
signing an excel workbook/code is not easy. My question deals with a mixture
of Excel and Outlook. I don't need to sign the Excel file, but I do need to
digitally sign the e-mail that is generated from within one of many Excel VBA
macros. I'm not sure if this action requires an additional "Add-in" or other
typically installed component to be "selected" or not.

An alternative would be to simply save the e-mail into the users Draft
folder or similar to allow the user to "forward" the message and apply the
appropriate Digital Signature. In order to meet the requirements posed I can
not first send the e-mail to the user and then let them forward and apply the
digital signature.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save and email a digitally signed excel file? SharePoint Workflow Enthusiast Excel Discussion (Misc queries) 3 June 5th 09 12:55 AM
Digitally signed timesheet Timcin New Users to Excel 3 December 9th 06 08:16 PM
Digitally signed Excel project problem ozpeter Excel Discussion (Misc queries) 0 August 3rd 05 10:59 AM
Sheets added by VBA invalidates digitally signed VBA project Dean J. Excel Programming 9 April 29th 05 06:24 PM
Digitally Signed Excel Sheet - can someone send me one? Kenji[_3_] Excel Programming 1 April 10th 04 10:56 PM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"