Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2023, 08:57 PM
syl3786 syl3786 is offline How to extract Excel data for Word Macro? Windows 10 How to extract Excel data for Word Macro? Office 2019
Advanced Beginner
How to extract Excel data for Word Macro?
 
Join Date: Jan 2023
Posts: 78
syl3786 is on a distinguished road
Question 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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract Excel data for Word Macro? 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
How to extract Excel data for Word Macro? Extract Excel Data from Chart in Word cillianmccolgan Word 1 08-15-2014 01:42 AM
How to extract Excel data for Word Macro? How to extract data from Excel database to create word report for each patient (row) nightale Word 3 07-06-2014 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft