+ Reply to Thread
Results 1 to 13 of 13

Re: Linking and opening jpeg files using hyperlinks/formulas

Hybrid View

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    Option Explicit
    
    Sub GetFileNames()
         
        Dim xRow As Long
        Dim xDirect, xFname$, InitialFoldr$
        Dim sn
        Dim i As Integer
        Dim d
        InitialFoldr$ = "C:\" '<<< Startup folder to begin searching from
         
        With Application.FileDialog(msoFileDialogFolderPicker)
            .InitialFileName = Application.DefaultFilePath & "\"
            .Title = "Please select a folder to list Files from"
            .InitialFileName = InitialFoldr$
            .Show
            If .SelectedItems.Count <> 0 Then
                xDirect = .SelectedItems(1) & "\"
                sn = Split(CreateObject("wscript.shell").exec("cmd /c dir " & xDirect & "/b/s").stdout.readall, vbCrLf)
                i = 2
                For Each d In sn
                    ActiveSheet.Hyperlinks.Add Cells(i, "A"), d
                    i = i + 1
                Next d
            End If
        End With
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    how can use this code

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    i have lot f scanned file that i want to link it to excel cell (every scanned paper to appropriate cell )
    this code can make this function or what

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    The project creates hyperlinks in COL A, beginning in A1 and down.

    Try it and see.

  5. #5
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    what you mean by list file

  6. #6
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    i understand now but i have folder with lot of photo with sequential number and want to give it link

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    example:

    Image2.jpg

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    Run the program on that folder.

  9. #9
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    Dear Logit
    i try with my folder that contain jpg photo
    but doen't happen
    but when i try with folder named intel in drive C it's work and give me file with extension log
    if your code for specific extension or how can change the extension

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    .
    It is designed to accept any extension. Edits to the existing code is not required.

  11. #11
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: Linking and opening jpeg files using hyperlinks/formulas

    thank you for your reply
    can please explain the code

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    Option Explicit
    
    Sub GetFileNames()
         
        Dim xRow As Long
        Dim xDirect, xFname$, InitialFoldr$
        Dim sn
        Dim i As Integer
        Dim d
        InitialFoldr$ = "C:\" '<<< Startup folder to begin searching from
         
        With Application.FileDialog(msoFileDialogFolderPicker)     '<-- Opens the FileDialog window so you can select the file
            .InitialFileName = Application.DefaultFilePath & "\"
            .Title = "Please select a folder to list Files from"
            .InitialFileName = InitialFoldr$
            .Show
            If .SelectedItems.Count <> 0 Then     '<-- So long as a file is selected ( SelectedItems 'not equal' to nothing )
                xDirect = .SelectedItems(1) & "\"
                sn = Split(CreateObject("wscript.shell").exec("cmd /c dir " & xDirect & "/b/s").stdout.readall, vbCrLf)
                i = 2
                For Each d In sn
                    ActiveSheet.Hyperlinks.Add Cells(i, "A"), d    '<-- Adds hyperlinks corresponding to each file located in the file you selected
                    i = i + 1
                Next d
            End If
        End With
    End Sub

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,405

    Re: Linking and opening jpeg files using hyperlinks/formulas

    Thanks for the add rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linking and opening jpeg files using hyperlinks/formulas
    By IGJ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-19-2017, 03:28 PM
  2. Replies: 0
    Last Post: 02-09-2015, 09:37 AM
  3. Replies: 0
    Last Post: 11-03-2014, 11:46 AM
  4. Print PDF, JPEG and TIF files
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-29-2012, 02:44 PM
  5. Linking a cell to a jpeg image
    By TheBigKangaroo in forum Excel General
    Replies: 1
    Last Post: 02-18-2012, 10:35 PM
  6. Opening Excel files and using cell values in formulas
    By denispoulin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2010, 05:12 PM
  7. jpeg files in excel
    By Andre in forum Excel General
    Replies: 1
    Last Post: 02-05-2005, 05:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1