Forum:SolidWorks
Thema:2013 ..muss f��r die Verwendung auf 64-Bit-System ..
Möchten Sie sich registrieren?
Wer darf antworten? Registrierte Benutzer können Beiträge verfassen.
Hinweise zur Registrierung Sie müssen registriert sein, um Beiträge oder Antworten auf Beiträge schreiben zu können.
Ihr Benutzername:
Ihr Kennwort:   Kennwort vergessen?
Anhang:    Datei(en) anhängen  <?>   Anhänge bearbeiten  <?>
Grafik für den Beitrag:                                                
                                                       
Ihre Antwort:

Fachbegriff
URL
Email
Fett
Kursiv
Durchgestr.
Liste
*
Bild
Zitat
Code

*HTML ist AUS
*UBB-Code ist AN
Smilies Legende
Netiquette

10 20 40

Optionen Smilies in diesem Beitrag deaktivieren.
Signatur anfügen: die Sie bei den Voreinstellungen angegeben haben.

Wenn Sie bereits registriert sind, aber Ihr Kennwort vergessen haben, klicken Sie bitte hier.

Bitte drücken Sie nicht mehrfach auf "Antwort speichern".

*Ist HTML- und/oder UBB-Code aktiviert, dann können Sie HTML und/oder UBB Code in Ihrem Beitrag verwenden.

T H E M A     A N S E H E N
Nase81

Beiträge: 1 / 0

Hallo,

ich habe ein ähnliches Problem. Ich habe vor Jahren mal ein Makro zum speichern unserer unserer e-mails geschrieben/zusammenkopiert.
Haben jetzt auf das 64bit Office umgestellt und ich bekomme das ding nicht mehr zum laufen. Habe das makro analog oben angepasst, bin mir aber nicht sicher welche Variablen-Deklarationen ich von Long auf LongPtr umstellen muss?:

Kann mir da jemand weiterhelfen?

Code:

Private Const EXM_OPT_FILENAME_BUILD As String = "em_<DATE>_<SUBJECT>"
Private Const EXM_OPT_CLEANSUBJECT_REGEX As String = "RE:\s|Re:\s|AW:\s|FW:\s|WG:\s|SV:\s|Antwort:\s"
Private Const EXM_OPT_FILENAME_DATEFORMAT As String = "mmdd"
Private Const MAX_PATH = 260

Private Type OpenFilename
  lStructSize As Long
  hWndOwner As Long
  hInstance As Long
  lpstrFilter As String
  lpstrCustomFilter As String
  nMaxCustFilter As Long
  nFilterIndex As Long
  lpstrFile As String
  nMaxFile As Long
  lpstrFileTitle As String
  nMaxFileTitle As Long
  lpstrInitialDir As String
  lpstrTitle As String
  Flags As Long
  nFileOffset As Integer
  nFileExtension As Integer
  lpstrDefExt As String
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type

Private Const OFN_ALLOWMULTISELECT = &H200
Private Const OFN_CREATEPROMPT = &H2000
Private Const OFN_ENABLEHOOK = &H20
Private Const OFN_ENABLETEMPLATE = &H40
Private Const OFN_ENABLETEMPLATEHANDLE = &H80
Private Const OFN_EXPLORER = &H80000
Private Const OFN_EXTENSIONDIFFERENT = &H400&
Private Const OFN_FILEMUSTEXIST = &H1000
Private Const OFN_HIDEREADONLY = &H4&
Private Const OFN_LONGNAMES = &H200000
Private Const OFN_NOCHANGEDIR = &H8&
Private Const OFN_NODEREFERENCELINKS = &H100000
Private Const OFN_NOLONGNAMES = &H40000
Private Const OFN_NONETWORKBUTTON = &H20000
Private Const OFN_NOTESTFILECREATE = &H10000
Private Const OFN_OVERWRITEPROMPT = &H2&
Private Const OFN_PATHMUSTEXIST = &H800
Private Const OFN_READONLY = &H1
Private Const OFN_SHAREAWARE = &H4000
Private Const OFN_SHAREFALLTHROUGH = 2
Private Const OFN_SHAREWARN = 0
Private Const OFN_SHARENOWARN = 1
Private Const OFN_SHOWHELP = &H10
Private Const OFS_MAXPATHNAME = 128

#If VBA7 Then
Private Declare PtrSafe Function GetSaveFileName Lib "comdlg32" _
  Alias "GetSaveFileNameA" ( _
  lpOpenfilename As OpenFilename) As Long

Private Declare PtrSafe Function CommDlgExtendedError Lib "comdlg32" () As Integer

Private Declare PtrSafe Function GetActiveWindow Lib "user32" () As Long

#Else
Private Declare Function GetSaveFileName Lib "comdlg32" _
  Alias "GetSaveFileNameA" ( _
  lpOpenfilename As OpenFilename) As Long

Private Declare Function CommDlgExtendedError Lib "comdlg32" () As Integer

Private Declare Function GetActiveWindow Lib "user32" () As Long
#End If

Public Sub Speichern_unter_EIN(MainPath As String)

    Dim myExplorer As Outlook.Explorer
    Dim myfolder As Outlook.MAPIFolder
   
    Set myExplorer = Application.ActiveExplorer
    Set myfolder = myExplorer.CurrentFolder

End Sub

Public Sub Speichern_unter(MainPath As String)

    Dim myExplorer As Outlook.Explorer
    Dim myfolder As Outlook.MAPIFolder
    Dim myItem As Object
    Dim olSelection As Selection

    Dim myMailItem As MailItem
    Dim strDate As String
    Dim strSender As String
    Dim strReceiver As String
    Dim strSubject As String
    Dim strFinalFileName As String
    Dim strFullPath As String
   
    Set myExplorer = Application.ActiveExplorer
    Set myfolder = myExplorer.CurrentFolder
    If myfolder Is Nothing Then Error 5001
    If Not myfolder.DefaultItemType = olMailItem Then GoTo ExitScript

    If myExplorer.Selection.Count > 1 Then
        MsgBox "Bitte nur eine E-Mail auswehlen"
        GoTo ExitScript
    End If
         
    If myExplorer.Selection.Count = 0 Then
        MsgBox "Bitte eine E-Mail auswehlen"
        GoTo ExitScript
    End If

    Set olSelection = myExplorer.Selection
    For Each myItem In olSelection
        If TypeOf myItem Is MailItem Then Set myMailItem = myItem
       
        strDate = Format(myMailItem.ReceivedTime, EXM_OPT_FILENAME_DATEFORMAT)
        strSender = myMailItem.SenderName
        strReceiver = myMailItem.To
        If InStr(strReceiver, ";") > 0 Then strReceiver = Left(strReceiver, InStr(strReceiver, ";") - 1)
        strSubject = myMailItem.Subject
        strFinalFileName = EXM_OPT_FILENAME_BUILD
        strFinalFileName = Replace(strFinalFileName, "<DATE>", strDate)
        strFinalFileName = Replace(strFinalFileName, "<SENDER>", strSender)
        strFinalFileName = Replace(strFinalFileName, "<RECEIVER>", strReceiver)
        strFinalFileName = Replace(strFinalFileName, "<SUBJECT>", strSubject)
        strFinalFileName = CleanString(strFinalFileName)
        If Left(strFinalFileName, 15) = "ERROR_OCCURRED:" Then
            strErrorMsg = Mid(strFinalFileName, 16, 9999)
            Error 1003
        End If
        strFinalFileName = IIf(Len(strFinalFileName) > 251, Left(strFinalFileName, 251), strFinalFileName)

        Flt$ = "Outlook Nachrichtenformat (.msg)|*.msg|"
        FName$ = GetSaveName(Flt$, "msg", MainPath, strFinalFileName)

        If FName$ = "" Then
            GoTo ExitScript
        Else
            myMailItem.SaveAs FName$, olMSG
        End If
      
        myMailItem.Categories = "gespeichert"
        myMailItem.Save
  
    Next

ExitScript:

End Sub

Private Function CleanString(strData As String) As String

    Const PROCNAME As String = "CleanString"

    On Error GoTo ErrorHandler

    Dim objRegExp As Object
    Set objRegExp = CreateObject("VBScript.RegExp")
    objRegExp.Global = True

    objRegExp.Pattern = EXM_OPT_CLEANSUBJECT_REGEX
    strData = objRegExp.Replace(strData, "")

    strData = Replace(strData, Chr(9), "_")
    strData = Replace(strData, Chr(10), "_")
    strData = Replace(strData, Chr(13), "_")
    objRegExp.Pattern = "[/\\*]"
    strData = objRegExp.Replace(strData, "-")
    objRegExp.Pattern = "[""]"
    strData = objRegExp.Replace(strData, "'")
    objRegExp.Pattern = "[:?<>\|]"
    strData = objRegExp.Replace(strData, "")
   
    objRegExp.Pattern = "\s+"
    strData = objRegExp.Replace(strData, " ")
    objRegExp.Pattern = "_+"
    strData = objRegExp.Replace(strData, "_")
    objRegExp.Pattern = "-+"
    strData = objRegExp.Replace(strData, "-")
    objRegExp.Pattern = "'+"
    strData = objRegExp.Replace(strData, "'")
           
    strData = Trim(strData)
   
    CleanString = strData
 
 
ExitScript:
    Exit Function
ErrorHandler:
    CleanString = "ERROR_OCCURRED:" & "Error #" & Err & ": " & Error$ & " (Procedure: " & PROCNAME & ")"
    Resume ExitScript
End Function

Private Function PrepareFilter(Flt$) As String
  Const O$ = "|"
  Dim Temp$
  Dim i As Integer
  Temp$ = Flt$
  i = 1
  Do While InStr(i, Flt$, O$) <> 0
    PrepareFilter = PrepareFilter + _
      Mid(Temp$, i, InStr(i, Temp$, O$) - i) + vbNullChar
    i = InStr(i, Temp$, O$) + Len(O$)
  Loop
  PrepareFilter = PrepareFilter + _
    Right(Temp$, Len(Temp$) - i + 1) + vbNullChar
End Function

Public Function GetSaveName(ByVal Filter$, ByVal DefExt$, ByVal InitialDir$, ByVal InitialName$) As String

  Dim OFN As OpenFilename
  Dim Temp$
  Dim n As Integer

  With OFN
    .lStructSize = Len(OFN)
    .hWndOwner = GetActiveWindow()
    .lpstrFilter = PrepareFilter(Filter$)
    .lpstrFile = InitialName$ & String$(700, vbNullChar)
    .nMaxFile = 700
    .lpstrFileTitle = String$(MAX_PATH, vbNullChar)
    .nMaxFileTitle = MAX_PATH
    .lpstrInitialDir = InitialDir$
    .lpstrTitle = "Speichern unter"
    .Flags = OFN_EXTENSIONDIFFERENT Or _
      OFN_NOCHANGEDIR Or OFN_OVERWRITEPROMPT _
      Or OFN_HIDEREADONLY
    .lpstrDefExt = DefExt$
  End With

  If GetSaveFileName(OFN) Then
    Temp$ = OFN.lpstrFile
    n = InStr(Temp$, vbNullChar)
    If n > 1 Then
      GetSaveName = Left$(Temp$, n - 1)
    Else
      GetSaveName = ""
    End If
  Else
    GetSaveName = ""
  End If


End Function




[Diese Nachricht wurde von Nase81 am 13. Nov. 2017 editiert.]