#1
|
|||
|
|||
How to extract Excel data for Word Macro?
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extract and insert text data from excel table(s) in a (embed) Word document | vladimiratanasiu | Word | 4 | 12-17-2020 05:25 AM |
Macro to extract bookmarked data from Word document and insert into another Word Document | VStebler | Word VBA | 3 | 05-03-2018 05:02 PM |
Macro to highlight repeated words in word file and extract into excel file | aabri | Word VBA | 1 | 06-14-2015 07:20 AM |
Extract Excel Data from Chart in Word | cillianmccolgan | Word | 1 | 08-15-2014 01:42 AM |
How to extract data from Excel database to create word report for each patient (row) | nightale | Word | 3 | 07-06-2014 04:17 PM |