How to Restrict data input to a specific cell - ms-access-2016

I'm creating a database in ms-access 2016, I want to set a field to email address that only accepts institutional e-mail address excluding such as Gmail, yahoo, Hotmail...etc, if user has entered such an e-mail address as above then the warning or error message be showed to enter correct value.
How can I do it?

You can use the function below in the BeforeUpdate event of the textbox:
Cancel = Not IsMailAddress(Nz(Me!YourTextbox.Value))
If Cancel = True Then
MessageBox "Please enter a valid e-mail address."
End If
and the function:
Public Function IsEmailAddress( _
ByVal strEmailAddresses As String) _
As Boolean
' Checks if strEMailAddr could represent one or more valid e-mail addresses.
' Does not check validity of domain names.
'
' 2003-06-22. Cactus Data ApS, CPH
' 2018-12-01. Expanded to allow for and validate multiple addresses.
' Allowed characters.
Const cstrValidChars As String = "#_-.0123456789abcdefghijklmnopqrstuvwxyz"
Const cstrDot As String = "."
Const cstrAt As String = "#"
' Minimum length of an e-mail address (a#a.ca).
Const cintAddressLenMin As Integer = 6
' Address separator.
Const cstrSeparator As String = ";"
Dim avarAddresses As Variant
Dim Index As Integer
Dim strEmailAddr As String
Dim strValidChars As String
Dim booFailed As Boolean
Dim intPos As Integer
Dim intI As Integer
avarAddresses = Split(strEmailAddresses, cstrSeparator)
For Index = LBound(avarAddresses) To UBound(avarAddresses)
strEmailAddr = avarAddresses(Index)
' Strip a display name.
CleanEmailAddress strEmailAddr
' Convert to lowercase.
strEmailAddr = LCase(strEmailAddr)
' Check that strEMailAddr contains allowed characters only.
For intI = 1 To Len(strEmailAddr)
If InStr(cstrValidChars, Mid(strEmailAddr, intI, 1)) = 0 Then
booFailed = True
End If
Next
If booFailed = False Then
' Check that the first character is not cstrAt.
booFailed = Left(strEmailAddr, 1) = cstrAt
If booFailed = False Then
' Check that the first character is not a cstrDot.
booFailed = Left(strEmailAddr, 1) = cstrDot
If booFailed = False Then
' Check that length of strEMailAddr exceeds
' minimum length of an e-mail address.
intPos = Len(strEmailAddr)
booFailed = (intPos < cintAddressLenMin)
If booFailed = False Then
' Check that none of the last two characters of strEMailAddr is a dot.
booFailed = (InStr(intPos - 1, strEmailAddr, cstrDot) > 0)
If booFailed = False Then
' Check that strEMailAddr does contain a cstrAt.
intPos = InStr(strEmailAddr, cstrAt)
booFailed = (intPos = 0)
If booFailed = False Then
' Check that strEMailAddr does contain one cstrAt only.
booFailed = (InStr(intPos + 1, strEmailAddr, cstrAt) > 0)
If booFailed = False Then
' Check that the character leading cstrAt is not cstrDot.
booFailed = (Mid(strEmailAddr, intPos - 1, 1) = cstrDot)
If booFailed = False Then
' Check that the character following cstrAt is not cstrDot.
booFailed = (Mid(strEmailAddr, intPos + 1, 1) = cstrDot)
If booFailed = False Then
' Check that strEMailAddr contains at least one cstrDot
' following the sign after cstrAt.
booFailed = Not (InStr(intPos, strEmailAddr, cstrDot) > 1)
End If
End If
End If
End If
End If
End If
End If
End If
End If
If booFailed = True Then
Exit For
End If
Next
IsEmailAddress = Not booFailed
End Function

Related

I get a Run-time error 3075 - Syntax error (missing operator) in query expression '[OReqID] = And [Item] = '

I am making a database using MS Access for my NGO, where we receive requisitions for relief materials from different centers and accordingly, we place an order to the supplier or dispatch from our stock. So generally, one requisition will have any one outcome either an order or dispatch. But rarely we may also send some quantity as dispatch and the rest as order. For example, we received a requisition from CoochBehar for 500 blankets. We placed an order for 375 blankets and dispatched 125 blankets from our stock.
I have two buttons on the Requisition form 'Order' & 'Challan'. I want to enable or disable them according to the situation. For new records, both should be enabled. I made a subroutine at the beginning and call it on the load event and current event of the form. It works for the existing data but when I try to enter a new record the error pos up.
I am using the following code -
Sub Check_Order_Dispatch()
Dim OrdCount As Integer
Dim DispCount As Integer
Dim OrdQnty As Double
Dim DispQnty As Double
Dim Qnty As Double
OrdCount = DCount("[OrdID]", "T02_Order_Details", "[OReqID] = " & Me.Txt_ReqID & " And [Item] = " & Me.Req_Details_SubF.Form!Cmbo_Item)
DispCount = DCount("[DispID]", "T04_Dispatch_Details", "[DReqID] = " & Me.Txt_ReqID & " And [Item] = " & [Req_Details_SubF].[Form]![Cmbo_Item])
OrdQnty = Nz(DLookup("Quantity", "T02_Order_Details", "[OReqID] = " & [Txt_ReqID] & " And [Item] =" & [Req_Details_SubF].[Form]![Cmbo_Item]), 0)
DispQnty = Nz(DLookup("Quantity", "T04_Dispatch_Details", "[DReqID] = " & [Txt_ReqID] & " And [Item] =" & [Req_Details_SubF].[Form]![Cmbo_Item]), 0)
Qnty = Me.Req_Details_SubF.Form!Txt_Quantity
If IsNull(Me.Txt_ReqID) Then
Btn_Challan.Enabled = True
Btn_Order.Enabled = True
Else
If OrdCount > 0 And OrdQnty < Qnty Then
Btn_Challan.Enabled = True
Btn_Order.Enabled = True
ElseIf OrdCount > 0 And OrdQnty >= Qnty Then
Btn_Challan.Enabled = False
Btn_Order.Enabled = True
ElseIf DispCount > 0 And DispQnty < Qnty Then
Btn_Challan.Enabled = True
Btn_Order.Enabled = True
ElseIf DispCount > 0 And DispQnty >= Qnty Then
Btn_Challan.Enabled = True
Btn_Order.Enabled = False
Else
Btn_Challan.Enabled = False
Btn_Order.Enabled = False
End If
End If
End Sub
I tried all possibilities that came to mind but to no effect. I am not very good at VBA. Please guide me. Thanks in advance!

Trying to set up mailing button VB

I have an Email button but I cant get it to work it is doing notng and i don really know why.
`Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles tbsEmailRenewal.Click
On Error GoTo Err_cmdEMailInvoice_Click
If tbsEmailRenewal.Tag = "" Then Exit Sub
' Create Report
Dim ListReport = New FastReport.Report
ListReport.Load(My.Settings.SystemPath & "\Reports\EmailRenewalLetter.frx")
ListReport.SetParameterValue("CRMConnectionString", "Data Source=" & My.Settings.SQLServer & ";AttachDbFilename=;Initial Catalog=ICOM.Database;Integrated Security=False;Persist Security Info=False;User ID=CRMUser;Password=S0rtmypc!")
ListReport.SetParameterValue("MemberID", objMember.MemberID)
ListReport.Prepare()
' Create Export File
Dim PDFExport As FastReport.Export.Pdf.PDFExport = New FastReport.Export.Pdf.PDFExport
ListReport.Export(PDFExport, My.Settings.SystemPath & "Reports\EMailReport" & Format(objMember.MemberID, "00000") & ".pdf")
' Create EMail
Dim objOutlook As Object
Dim objMailMessage As Outlook.MailItem
objOutlook = CreateObject("Outlook.Application")
objMailMessage = objOutlook.CreateItem(0)
With objMailMessage
.To = txtEmailAddess1.Text
.Subject = "Renewal For " & lblMemberIDValue.Text
.Attachments.Add(My.Settings.SystemPath & "Reports\EMailReport" & Format(objMember.MemberID, "00000") & ".pdf")
.Display()
.Save()
.Close(Outlook.OlInspectorClose.olDiscard)
End With
objMailMessage = Nothing
objOutlook = Nothing
' Log It
Dim sMessage As String
sMessage = Replace(">" & Format(objMember.MemberID, "00000") & " to " & tbsEmailRenewal.Tag, "'", "`")
WriteAuditLogRecord(Me.Name, "tbsEmailRenewal.Click", "INFO", sMessage)
MsgBox("Email has been saved as a Draft", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "ICOM - Action Confirmed")
Err_cmdEMailInvoice_Click:
If Err.Number <> 0 Then
sErrDescription = Err.Description
WriteAuditLogRecord(Me.Name, "cmdEMailInvoice_Click", "Error", sErrDescription)
MsgBox("System Error occurred" & Chr(13) & "tbsEmailRenewal.Click" & Chr(13) & sErrDescription, MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "AztecCRM - Error Reporting")
End If
End Sub`
Are you sure that tbsEmailRenewal.Tag is not empty?
If tbsEmailRenewal.Tag = "" Then Exit Sub

Parsing EMail with VB6 - not splitting properly

When I parse through an email that looks like:
included_po~301993959 'VBCRLF
po_no~vendor~part_no~class~type_code~buyer~qty_ordered~measure~balance_on_order~cost~amt_ordered~order_date~delivery_date~ship_Date~receive_date~open~wo_no 'VBCRLF
301993959~100000~88008K~PROBE 800~F~VAX~4.0 ~EA~4.0~100.3300~401.32000~011513~012313~012313~000000~Y~STOCK 'VBCRLF
301993959~100000~TFCI-010-50~WIRE SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~STOCK 'VBCRLF
301993959~100000~TFIR-010-50~WIRE SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~STOCK 'VBCRLF
using code:
Public Sub AddItems()
Dim aLineItem() As String
Dim aItem() As String
Dim i As Integer
Dim j As Integer
Dim iCnt As Double
Dim msg
Dim Item As Items
ReDim sWo(0)
iCnt = 0
For i = 1 To UBound(sMsg())
aLineItem = Split(sMsg(i), vbCrLf)
For j = 1 To UBound(aLineItem)
If aLineItem(j) <> "" Then
If blah = 1 Then
Debug.Print ("...." & aLineItem(j))
End If
aItem = Split(aLineItem(j), "~")
If (aItem(0) <> "") And (aItem(0) <> "included_po") And (aItem(0) <> "po_no") Then
Item.PO_num = GetWo(aItem(1))
If Item.PO_num <> "0" Then
Item.Company = aItem(1)
Item.Delivery_date = aItem(12)
Item.pn = aItem(2)
Item.QTY_ordered = aItem(6)
Item.Unit_Price = aItem(9)
End If 'If Item.PO_num <> "0" Then
End If 'If aItem(1) <> "" Then
End If ' If aLineItem(j) <> "" Then
Next j
Next i
End Sub
The email parsing looks like this:
....301993959~100000~88008K~PROBE
....8800~F~VAX~4.0~EA~4.0~100.3300~401.32000~011513~012313~012313~000000~Y~S
....TOCK
Is there a better way to parse this email?
EDIT #1:
Public Sub GetMailMsg()
Dim pop3 As jmail.pop3
Dim iCount As Integer
Dim i As Integer
Dim mailID As Integer
Dim j As Integer
Dim sSubject As String
j = 0
ReDim sMsg(0)
'connect to the mail box
Set pop3 = New pop3
pop3.Connect "REMOVED FOR SECURITY"
'Get message count
iCount = pop3.Count
'Read Messages
For i = 1 To iCount
sSubject = pop3.Messages.Item(i).Subject
Label1.Caption = "Reading message.." & sSubject
DoEvents
If InStr(sSubject, "China Purchase Orders") <> 0 Then 'email test
j = j + 1
ReDim Preserve sMsg(j)
sMsg(j) = pop3.Messages.Item(i).Body
Label1.Caption = "Reading mail message for order " & sSubject
If blah = 1 Then
Debug.Print ("Reading mail message for order " & sSubject)
Debug.Print ("Reading mail message for order " & sMsg(j))
End If
End If
Next
pop3.Disconnect
Set pop3 = Nothing
End SUb
--EDIT #2
OUTPUT FROM DEBUG:
Reading mail message for order China Purchase Orders
Reading mail message for order
included_po~301993959
po_no~vendor~part_no~class~type_code~buyer~qty_ordered~measure~balance_o 'VBCRLF
n_order~cost~amt_ordered~order_date~delivery_date~ship_Date~receive_date 'VBCRLF
~open~wo_no 'VBCRLF
301993959~100000~88008K~PROBE 'VBCRLF
8800~F~VAX~4.0~EA~4.0~100.3300~401.32000~011513~012313~012313~000000~Y~S 'VBCRLF
TOCK 'VBCRLF
301993959~100000~TFCI-010-50~WIRE 'VBCRLF
SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~ST 'VBCRLF
OCK 'VBCRLF
301993959~100000~TFIR-010-50~WIRE 'VBCRLF
SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~ST 'VBCRLF
OCK 'VBCRLF
Your lines aren't breaking up properly makes me think there is a problem in the line aLineItem = Split(sMsg(i), vbCrLf). Please check whether you don't have any vbCrLF in the line you aren't getting right.
Is that line one continuous line?
Edit #1 # Jan 16, 2013 1:16pm EST:
I created a file and pasted provided input.
I created a simple program and incorporated your code into it. Please see produced DEBUG below, consisting as expected with 3 lines beginning with 301993959 and ending with STOCK. This is the correct and desirable output, right?
....301993959~100000~TFCI-010-50~WIRE SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~STOCK
....301993959~100000~TFIR-010-50~WIRE SPTEF~F~VAX~1.0~SP~1.0~12.6400~12.64000~011513~012313~012313~000000~Y~STOCK
....301993959~100000~88008K~PROBE 800~F~VAX~4.0 ~EA~4.0~100.3300~401.32000~011513~012313~012313~000000~Y~STOCK
So the code you provided is working fine. If you say the input file is fine too, that means the issue is with how you are reading that email, specifically how you populate sMsg(). Can you post that code please?
Edit #2 # Jan 16, 2013 2:32pm EST:
You are getting some unwanted vbCrLfs in your single record line and you can't split it the way you want. Here is what I suggest you do:
1) If you can modify GetMailMsg to instead of loading Body as it is, go through line by line to avoid generating unwanted vbCrLfs. I have zero experience with pop objects so I don't know if that is possible.
2) If the number of unwanted cbCrLfs is consistent, ex: 2 in a single record, then you can simply adjust your code to concatenate split records like this
DIM concatLine As String
For j = 1 To UBound(aLineItem) Step 3
concatLine = aLineItem(j) & aLineItem(j+1) & aLineItem(j+2)
If concatLine <> "" Then
If blah = 1 Then
Debug.Print ("...." & concatLine)
End If
aItem = Split(concatLine, "~")
If (aItem(0) <> "") And (aItem(0) <> "included_po") And (aItem(0) <> "po_no") Then
Item.PO_num = GetWo(aItem(1))
If Item.PO_num <> "0" Then
Item.Company = aItem(1)
Item.Delivery_date = aItem(12)
Item.pn = aItem(2)
Item.QTY_ordered = aItem(6)
Item.Unit_Price = aItem(9)
End If 'If Item.PO_num <> "0" Then
End If 'If aItem(1) <> "" Then
End If ' If concatLine <> "" Then
Next j
3) or better yet, concat string until you reach the end of the record and then split that concatenated string.
DIM concatLine As String
DIM detailsRecord as Integer
For detailsRecord = 1 To UBound(aLineItem)
if LCase(Right(aLineItem(detailsRecord),5)) = 'wo_no' Then Exit For ' when we find this tag, we know where details record begin
Next detailsRecord
For j = detailsRecord + 1 To UBound(aLineItem) ' begin looping detail records
concatLine = concatLine + aLineItem(j)
If UCase(Right(aLineItem(j), 5)) = "STOCK" Then ' this is your end of the record indicator
If blah = 1 Then
Debug.Print ("...." & concatLine)
End If
aItem = Split(concatLine, "~")
If (aItem(0) <> "") Then
Item.PO_num = GetWo(aItem(1))
If Item.PO_num <> "0" Then
Item.Company = aItem(1)
Item.Delivery_date = aItem(12)
Item.pn = aItem(2)
Item.QTY_ordered = aItem(6)
Item.Unit_Price = aItem(9)
End If 'If Item.PO_num <> "0" Then
End If 'If aItem(1) <> "" Then
End If ' If concatLine <> "" Then
concatLine = ""
Next j
For cases 2 and 3, don't forget to handle the headers first- you will have to move If (aItem(0) <> "") And (aItem(0) <> "included_po") And (aItem(0) <> "po_no") outside the main loop to handle header records (i believe the first 2 or records are headers).
EDIT #3:
I fixed scenario #3 to skip through the header records (assuming 'wo_no' is an indicator of the end of that record), then to concatenate strings to form a single record by searching for an end tag ("STOCK"). This method is going to be flexible enough to handle dynamic number of vbCrLfs in the email body that splits a single record into unpredictable number of strings.
The code was typed in the browser, so I don't guarantee it will work :)
Since you know what should start each line, then use the Split function using "301993959".
Dim LineItems(100) As String
x = Split(sMsg(i), "301993959")
For j = 1 To UBound(x) - 1 'Don't use 0 becuase you don't need that part
LineItems(j - 1) = x(j)
Next i
Of Course you could take it one step further by then splitting each item in the string using "~" as your second delimiter.
Dim LineItems(100, 15) As String
x = Split(Text1.Text, "301993959")
For j = 1 To UBound(x) - 1 'Don't use 0 becuase you don't need that part
y = Split(x(j), "~")
For k = 1 To 15
LineItems(j - 1, k) = y(k)
Next k
Next j

"Error: attempt to index local 'self' (a nil value)" in string.split function

Quick facts, I got this function from http://lua-users.org/wiki/SplitJoin at the very bottom, and am attempting to use it in the Corona SDK, though I doubt that's important.
function string:split(sSeparator, nMax, bRegexp)
assert(sSeparator ~= '')
assert(nMax == nil or nMax >= 1)
local aRecord = {}
if self:len() > 0 then
local bPlain = not bRegexp
nMax = nMax or -1
local nField=1 nStart=1
local nFirst,nLast = self:find(sSeparator, nStart, bPlain)
while nFirst and nMax ~= 0 do
aRecord[nField] = self:sub(nStart, nFirst-1)
nField = nField+1
nStart = nLast+1
nFirst,nLast = self:find(sSeparator, nStart, bPlain)
nMax = nMax-1
end
aRecord[nField] = self:sub(nStart)
end
return aRecord
end
The input: "1316982303 Searching server"
msglist = string.split(msg, ' ')
Gives me the error in the title. Any ideas? I'm fairly certain it's just the function is out of date.
Edit: lots more code
Here's some more from the main.lua file:
multiplayer = pubnub.new({
publish_key = "demo",
subscribe_key = "demo",
secret_key = nil,
ssl = nil, -- ENABLE SSL?
origin = "pubsub.pubnub.com" -- PUBNUB CLOUD ORIGIN
})
multiplayer:subscribe({
channel = "MBPocketChange",
callback = function(msg)
-- MESSAGE RECEIVED!!!
print (msg)
msglist = string.split(msg, ' ')
local recipient = msglist[0] --Get the value
table.remove(msglist, 0) --Remove the value from the table.
local cmdarg = msglist[0]
table.remove(msglist, 0)
arglist = string.split(cmdarg, ',')
local command = arglist[0]
table.remove(arglist, 0)
argCount = 1
while #arglist > 0 do
argname = "arg" .. argCount
_G[argname] = arglist[0]
table.remove(arglist, 0)
argCount = argCount + 1
end
Server.py:
This is the multiplayer server that sends the necessary info to clients.
import sys
import tornado
import os
from Pubnub import Pubnub
## Initiat Class
pubnub = Pubnub( 'demo', 'demo', None, False )
## Subscribe Example
def receive(message) :
test = str(message)
msglist = test.split()
recipient = msglist.pop(0)
msg = msglist.pop(0)
id = msglist.pop(0)
if id != "server":
print id
print msg
commandHandler(msg,id)
return True
def commandHandler(cmd,id):
global needOp
needOp = False
global matchListing
if server is True:
cmdArgList = cmd.split(',')
cmd = cmdArgList.pop(0)
while len(cmdArgList) > 0:
argument = 1
locals()["arg" + str(argument)] = cmdArgList.pop(0)
argument += 1
if cmd == "Seeking":
if needOp != False and needOp != id:
needOp = str(needOp)
id = str(id)
pubnub.publish({
'channel' : 'MBPocketChange',
#Message order is, and should remain:
#----------Recipient, Command,Arguments, Sender
'message' : needOp + " FoundOp," + id + " server"
})
print ("Attempting to match " + id + " with " + needOp + ".")
needOp = False
matchListing[needOp] = id
else:
needOp = id
pubnub.publish({
'channel' : 'MBPocketChange',
#Message order is, and should remain:
#----------Recipient, Command,Arguments, Sender
'message' : id + ' Searching server'
})
print "Finding a match for: " + id
elif cmd == "Confirm":
if matchListing[id] == arg1:
pubnub.publish({
'channel' : 'MBPocketChange',
#Message order is, and should remain:
#----------Recipient, Command,Arguments, Sender
'message' : arg1 + ' FoundCOp,' + id + ' server'
})
matchListing[arg1] = id
else:
pass #Cheater.
elif cmd == "SConfirm":
if matchListing[id] == arg1 and matchListing[arg1] == id:
os.system('python server.py MBPocketChange' + arg1)
#Here, the argument tells both players what room to join.
#The room is created from the first player's ID.
pubnub.publish({
'channel' : 'MBPocketChange',
#Message order is, and should remain:
#----------Recipient, Command,Arguments, Sender
'message' : id + ' GameStart,' + arg1 + ' server'
})
pubnub.publish({
'channel' : 'MBPocketChange',
#Message order is, and should remain:
#----------Recipient, Command,Arguments, Sender
'message' : arg1 + ' GameStart,' + arg1 + ' server'
})
else:
pass #hax
else:
pass
def connected():
pass
try:
channel = sys.argv[1]
server = False
print("Listening for messages on '%s' channel..." % channel)
pubnub.subscribe({
'channel' : channel,
'connect' : connected,
'callback' : receive
})
except:
channel = "MBPocketChange"
server = True
print("Listening for messages on '%s' channel..." % channel)
pubnub.subscribe({
'channel' : channel,
'connect' : connected,
'callback' : receive
})
tornado.ioloop.IOLoop.instance().start()
This error message happens if you run:
string.split(nil, ' ')
Double check your inputs to be sure you are really passing in a string.
Edit: in particular, msglist[0] is not the first position in the array in Lua, Lua arrays start at 1.
As an aside, this function was written when the intention that you'd use the colon syntactic sugar, e.g.
msglist=msg:split(' ')

VBA to parse multiple text files?

I'm trying to do some crude parsing of a bunch of text files. Basically, I'm looking to remove characters like (){}[]"', then replace colons with semicolons then replace strings with better looking strings.
The kicker is that I have about 1,500 files that need to have this done to them. If I merge all the files, first, then try to do the parsing, the app stops responding.
I have been using windows macros to do this, and it works on each of the files individually, but I don't know how to have it do it to all the files in that directory.
Example of the code I'm using:
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "["
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
The following sub will iterate through a directory you specify and make the string changes you want:
Option Explicit
Sub FileProcessing()
Dim fileDirectory As String
Dim fileName As String
Dim fileContents As String
Dim inputFileNumber As Integer
Dim outputFileNumber As Integer
Dim iFileCount As Integer
fileDirectory = "C:\deleteme\"
'Get first file in directory
fileName = Dir(fileDirectory & "*.*")
'Begin loop to iterate through each file
Do While fileName <> ""
If iFileCount Mod 50 Then 'Display a message in Immediate window for every 50 files
Debug.Print "Working on file number " & iFileCount & " : " & fileName
End If
'Open File
inputFileNumber = FreeFile
Open fileDirectory & fileName For Input As #inputFileNumber
'Put file contents into a variable
'NOTE: A variable-length string can contain up to approximately 2 billion (2^31) characters.
fileContents = Input$(LOF(inputFileNumber), 1)
'Close the File
Close #inputFileNumber
'Do your replacements
fileContents = Replace(fileContents, "(", "")
fileContents = Replace(fileContents, ")", "")
fileContents = Replace(fileContents, "{", "")
fileContents = Replace(fileContents, "}", "")
fileContents = Replace(fileContents, "[", "")
fileContents = Replace(fileContents, "]", "")
fileContents = Replace(fileContents, ":", ";")
'Get the output file ready to write:
outputFileNumber = FreeFile
Open fileDirectory & fileName For Output As #outputFileNumber
Print #outputFileNumber, fileContents
Close #outputFileNumber
'Get next file
fileName = Dir
Loop
MsgBox "Finished"
End Sub

Resources