Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function strSaveAsType(strDoc As String, ByVal strType As String, strFileName As String, strTargetPath As String, blnOverwrite As Boolean, lngBackColor As Long) As String
' Procedure :   strSaveAsType
' Description:  Save a file in a specific format, such as "HTML".
' Copyright:    Chris Greaves Inc.
' Inputs:       A document name, a file type.
' Returns:      None.
' Assumes:      None.
' Side Effects: None.
' Tested:       By the calls shown below.
    ActiveDocument.Background.Fill.Visible = msoTrue
    ActiveDocument.Background.Fill.Solid
    ActiveDocument.Background.Fill.ForeColor = lngBackColor
    strSaveAsType = ""
    Dim fc As FileConverter
    Dim intTypeSave As Integer
    ' Determine Saveformat of HTML converter
    For Each fc In Application.FileConverters
        If UCase(fc.ClassName) = UCase(strType) Then
            intTypeSave = fc.SaveFormat
            strType = Left(strType, 3)
            Dim strFile As String
            strFile = strFileName & strcExtentSeparator & strType
            strFile = strReplaceAll(strFile, " ", "")
            If boolFileExists(strTargetPath & strFile) Then
                If blnOverwrite Then
                    Call doQKill(strTargetPath & strFile)
                    strSaveAsType = strFile
                    Documents(strDoc).SaveAs FileName:=strTargetPath & strFile, FileFormat:=intTypeSave
                    Exit For
                Else
                    Call ERL("File already exists", intcErrorSevere, strTargetPath & strFile)
                End If
            Else
                strSaveAsType = strFile
                Documents(strDoc).SaveAs FileName:=strTargetPath & strFile, FileFormat:=intTypeSave
                Exit For
            End If
        End If
    Next fc
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function strSaveAsType(strDoc As String, ByVal strType As String, strFileName As String, strTargetPath As String, blnOverwrite As Boolean, lngBackColor As Long) As String
' Procedure :   strSaveAsType
' Description:  Save a file in a specific format, such as "HTML".
' Copyright:    Chris Greaves Inc.
' Inputs:       A document name, a file type.
' Returns:      None.
' Assumes:      None.
' Side Effects: None.
' Tested:       By the calls shown below.
    ActiveDocument.Background.Fill.Visible = msoTrue
    ActiveDocument.Background.Fill.Solid
    ActiveDocument.Background.Fill.ForeColor = lngBackColor
    strSaveAsType = ""
    Dim fc As FileConverter
    Dim intTypeSave As Integer
    ' Determine Saveformat of HTML converter
    For Each fc In Application.FileConverters
        If UCase(fc.ClassName) = UCase(strType) Then
            intTypeSave = fc.SaveFormat
            strType = Left(strType, 3)
            Dim strFile As String
            strFile = strFileName & strcExtentSeparator & strType
            strFile = strReplaceAll(strFile, " ", "")
            If boolFileExists(strTargetPath & strFile) Then
                If blnOverwrite Then
                    Call doQKill(strTargetPath & strFile)
                    strSaveAsType = strFile
                    Documents(strDoc).SaveAs FileName:=strTargetPath & strFile, FileFormat:=intTypeSave
                    Exit For
                Else
                    Call ERL("File already exists", intcErrorSevere, strTargetPath & strFile)
                End If
            Else
                strSaveAsType = strFile
                Documents(strDoc).SaveAs FileName:=strTargetPath & strFile, FileFormat:=intTypeSave
                Exit For
            End If
        End If
    Next fc
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1