Hi everyone,
I would like to ask how to add some codes to the following code, so that the following macro can extract Excel data, Text = "[0-9]{6}" for Word Macro.
Code:
Private strWB As String
Private strSheet As String
Sub ReplaceHLink()
strWB = BrowseForFile("Select Workbook", True)
If Not strWB = vbNullString Then
strSheet = "Time"
End With
End If
End Sub
Private Function BrowseForFile(Optional strTitle As String, Optional bExcel As Boolean) As String
Dim fDialog As FileDialog
On Error GoTo ERR_HANDLER
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = strTitle
.AllowMultiSelect = False
.Filters.Clear
If bExcel Then
.Filters.Add "Excel workbooks", "*.xls,*.xlsx,*.xlsm"
Else
.Filters.Add "Word documents", "*.doc,*.docx,*.docm"
End If
.InitialView = msoFileDialogViewList
If .Show <> -1 Then GoTo ERR_HANDLER:
BrowseForFile = fDialog.SelectedItems.item(1)
End With
lbl_Exit:
Exit Function
ERR_HANDLER:
BrowseForFile = vbNullString
Resume lbl_Exit
End Function