Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I change the connection "Connection:="TEXT;C:\Users\Alex\Desktop\SalesData.txt"," to a different module? #18

Open
OzBlake opened this issue Dec 3, 2022 · 2 comments

Comments

@OzBlake
Copy link

OzBlake commented Dec 3, 2022

With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\Users\Alex\Desktop\SalesData.txt", Destination:=Range("$A$1"))

@OzBlake
Copy link
Author

OzBlake commented Dec 3, 2022

Need Help Please..

How do I change the connection to with ActiveSheet.QueryTables.Add(Connection:="TEXT............ the get_path module?

Sub get_path_D01()
    Dim diaFolder As FileDialog
    Dim Fname As String

    Set diaFolder = Application.FileDialog(msoFileDialogFilePicker)
                                          'msoFileDialogFilePicker
                                          'msoFileDialogFolderPicker
                                          'msoFileDialogOpen
                                          'msoFileDialogSaveAs
    diaFolder.AllowMultiSelect = False
    
    If diaFolder.Show = -1 Then
        Fname = diaFolder.SelectedItems(1)
        Cells(3, "b").Value = Fname
    Else
        Exit Sub
    End If
End Sub

Sub CreatDataTable()
with ActiveSheet.QueryTables.Add(Connection:="TEXT............

@areed1192
Copy link
Owner

You just need to point to a different file path:

C:\Users\Alex\Desktop\SalesData.txt

so just change the path to where the file is and then you should be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants