Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub Wild()
Dim r As Range
Dim myVar As String
Set r = ActiveDocument.Range
With r.Find
.ClearFormatting
.MatchWildcards = True
.Text = "yad*a"
.Execute
myVar = r.Text
End With
MsgBox myVar
End Sub
Sub Wild_2()
Dim r As Range
Dim AllOfThem As String
Set r = ActiveDocument.Range
With r.Find
.ClearFormatting
.MatchWildcards = True
.Text = "yad*a"
Do While .Execute(Forward:=True) = True
AllOfThem = AllOfThem & r.Text & _
vbCrLf
Loop
End With
MsgBox AllOfThem
End Sub
Sub test()
'
' test Macro
'
'
Set objDoc = ActiveDocument
Dim r As Range
Dim FileName As String
Set r = ActiveDocument.Range
With r.Find
.ClearFormatting
.MatchWildcards = True
.Text = "~*~"
.Execute
End With
FileName = Replace(r.Text, "~", "")
FileName = RTrim(FileName)
FileName = LTrim(FileName)
FileName = "C:\" & FileName & ".doc"
MsgBox FileName
objDoc.SaveAs (FileName)
End Sub
[green]' ...[/green]
[blue]Set r = ActiveDocument.Range
With r.Find
.ClearFormatting
.MatchWildcards = True
.Text = "~*~"
.Execute
End With
[red]If r.Find.Found = true then[/red]
FileName = [green]' etc. [/green]
[red]Else
[green]' do something else[/green]
EndIf[/red][/blue]
Sub test()
'
' test Macro
'
'
Dim r As Range
Dim FileName As String, filesys, createdate, Today
Set r = ActiveDocument.Range
With r.Find
.ClearFormatting
.MatchWildcards = True
.Text = "~*~"
.Execute
End With
' Search for filename in document and save
If r.Find.Found = True Then
FileName = Replace(r.Text, "~", "")
FileName = RTrim(FileName)
FileName = LTrim(FileName)
FileName = "C:\" & FileName & ".doc"
objDoc.SaveAs (FileName)
' Check file has been saved
' Check File exists first and if it does check the time stamp to be sure
If objFSO.FileExists(FileName) Then
' Get Date of document saved.
Set tempfile = objFSO.GetFile(FileName)
createdate = tempfile.DateCreated
Today = Date
' Check Date of file is today
If DateDiff("d", Today, createdate) = 0 Then
MsgBox "File appears to be saved correctly"
Else
MsgBox "There is a problem, with verifying file is saved please contact System Administrator"
End If
Else
MsgBox "There is a problem, with verifying file is saved please contact System Administrator"
Exit Sub
End If
Else
MsgBox "Error finding filename in document, please try again. Document was NOT sent. Sorry."
End If
End Sub