Click here to Skip to main content
15,886,026 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
Richard MacCutchan29-Oct-19 23:09
mveRichard MacCutchan29-Oct-19 23:09 
GeneralRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
fd975029-Oct-19 23:23
professionalfd975029-Oct-19 23:23 
GeneralRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
fd975030-Oct-19 0:02
professionalfd975030-Oct-19 0:02 
QuestionHow to solve problem with datagrid and tabcontrol(vb.net) Pin
Member 1447080727-Oct-19 22:52
Member 1447080727-Oct-19 22:52 
AnswerRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Richard MacCutchan27-Oct-19 23:14
mveRichard MacCutchan27-Oct-19 23:14 
GeneralRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Member 1447080730-Oct-19 17:33
Member 1447080730-Oct-19 17:33 
GeneralRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Richard MacCutchan30-Oct-19 22:58
mveRichard MacCutchan30-Oct-19 22:58 
QuestionVB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 21:29
Member 1463660627-Oct-19 21:29 
Dear all,

Hope you can help me out, i am new to VB scripting and i get the question from a customer to help them out with there VB script, They have the script below that is working fine on a windows 7 + Office 2013 computer but now they are migrated to a Windows 10 device with Office 365 and the script is stoped working.

It is a VB script in Excel/Access that can save the selected e-mail in outlook to a *.msg file:

VB
<pre>Sub SlaMailOp()
'Haal het ID op van de momenteel geselecteerde mail
Dim olApp As Outlook.Application, olNs As Namespace, Item As Object, eFldr As Object
Dim MailItem As Variant
Dim Onderwerp As String
On Error GoTo ErrorHandler
Set olApp = GetObject(, "Outlook.Application")
tmpOpenTextInvoer = "C:\temp\OpenTextInvoer"
If olApp Is Nothing Then
    Set olApp = CreateObject("Outlook.Application")
End If

' Set the reference to the oulook MAPI namespace
Set olNs = olApp.GetNamespace("MAPI")

Set eFldr = olNs.Application.ActiveExplorer.Selection
'If eFldr.Count > 1 Then
'    MsgBox "Er mag maar 1 e-mail geselecteerd zijn. Probeer het opnieuw", vbCritical
'    Exit Sub
'End If

For Each MailItem In eFldr

'Onderwerp = PasGeldigheidBestandsnaamAan(Left(eFldr.Item(1).Subject, 50))
'eFldr.Item(1).SaveAs "C:\TEMP\OpenTextInvoer\" & Onderwerp & ".msg"
If Dir(tmpOpenTextInvoer, vbDirectory) = "" Then
    MkDir tmpOpenTextInvoer
End If

    Onderwerp = PasGeldigheidBestandsnaamAan(Left(MailItem.Subject, 120)) & "_" & Format(Now, "YYMMDDHHMMSS")
    
    MailItem.SaveAs tmpOpenTextInvoer & "\" & Onderwerp & ".msg"
    
Next
'Onderwerp = Left(eFldr.Item(1).Subject, 50)
'OlId = eFldr.Item(1).EntryID
'Datum_binnenkomst = Format(eFldr.Item(1).ReceivedTime, "DD-MM-YYYY")

Set olApp = Nothing
Set olNs = Nothing

Set eFldr = Nothing

Exit Sub
ErrorHandler:
MsgBox "Er is een fout opgetreden bij het ophalen van de e-mail informatie! Is Outlook wel opgestart?" & vbCr & Err.Description, vbCritical
End Sub

Function PasGeldigheidBestandsnaamAan(Naam As String)


Naam = Replace(Naam, ":", "_")
Naam = Replace(Naam, "\", "_")
Naam = Replace(Naam, "/", "_")
Naam = Replace(Naam, "*", "_")
Naam = Replace(Naam, "?", "_")
Naam = Replace(Naam, "<", "_")
Naam = Replace(Naam, ">", "_")
Naam = Replace(Naam, "|", "_")
Naam = Replace(Naam, """", "_")
Naam = Replace(Naam, " ", "_")
Naam = Replace(Naam, "€", "EUR")
Naam = Replace(Naam, """, "")
Naam = Replace(Naam, "'", "")
Naam = Replace(Naam, "’", "")
Naam = Replace(Naam, "Ë", "E")
Naam = Replace(Naam, "ë", "e")
Naam = Replace(Naam, "Ö", "O")
Naam = Replace(Naam, "ö", "o")
Naam = Replace(Naam, "Ü", "U")
Naam = Replace(Naam, "ü", "u")
Naam = Replace(Naam, "@", "_AT_")
Naam = Replace(Naam, "#", "_")
Naam = Replace(Naam, "___", "_")
Naam = Replace(Naam, "__", "_")

PasGeldigheidBestandsnaamAan = Naam

End Function

Function Ampersand(Naam As String)

Ampersand = Replace(Naam, "&", "&")

End Function


AnswerRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 21:33
mveOriginalGriff27-Oct-19 21:33 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 21:36
Member 1463660627-Oct-19 21:36 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 21:39
mveOriginalGriff27-Oct-19 21:39 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 22:28
Member 1463660627-Oct-19 22:28 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 22:41
mveOriginalGriff27-Oct-19 22:41 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 22:53
Member 1463660627-Oct-19 22:53 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 23:08
mveOriginalGriff27-Oct-19 23:08 
QuestionListbox event, ItemSelectionChanged, how to wait for last event, or cancel events Pin
jkirkerx24-Oct-19 7:36
professionaljkirkerx24-Oct-19 7:36 
AnswerRe: Listbox event, ItemSelectionChanged, how to wait for last event, or cancel events Pin
Dave Kreskowiak24-Oct-19 15:35
mveDave Kreskowiak24-Oct-19 15:35 
GeneralRe: Listbox event, ItemSelectionChanged, how to wait for last event, or cancel events Pin
jkirkerx25-Oct-19 10:56
professionaljkirkerx25-Oct-19 10:56 
Questionhow i create a video conference program Pin
Member 1462143013-Oct-19 8:09
Member 1462143013-Oct-19 8:09 
AnswerRe: how i create a video conference program PinPopular
Dave Kreskowiak13-Oct-19 16:05
mveDave Kreskowiak13-Oct-19 16:05 
QuestionStepper Motor control code Pin
Member 1462018511-Oct-19 12:10
Member 1462018511-Oct-19 12:10 
AnswerRe: Stepper Motor control code Pin
Eddy Vluggen11-Oct-19 12:44
professionalEddy Vluggen11-Oct-19 12:44 
AnswerRe: Stepper Motor control code Pin
CHill6021-Oct-19 5:37
mveCHill6021-Oct-19 5:37 
QuestionMove to Windows 10 on HP messes up display Pin
Todd (10789346)9-Oct-19 4:30
Todd (10789346)9-Oct-19 4:30 
AnswerRe: Move to Windows 10 on HP messes up display Pin
Gerry Schmitz9-Oct-19 9:18
mveGerry Schmitz9-Oct-19 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.