Consulting

Results 1 to 4 of 4

Thread: Windows 7 external file open

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Windows 7 external file open

    I have the following code

    [VBA]Sub cmdbtnFetchFile_Click()

    Dim strAddress As String, res As String

    Application.CutCopyMode = False

    Selection.Copy

    ChDir "C:\"
    Workbooks.Open Filename:="C:\SN barcodes.xls"

    Sheets("Barcodes").Select
    Range("B2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Range("A2:A65536").Select
    Selection.ClearContents

    Range("B2:B65536").Select
    Selection.Cut

    Range("A2").Select
    ActiveSheet.Paste

    ActiveWorkbook.Save
    ActiveWorkbook.Close

    On Error GoTo NoFile
    strAddress = "C:\Incoming grabber.lab"
    ActiveWorkbook.FollowHyperlink Address:=strAddress
    Exit Sub

    NoFile:
    MsgBox "Sorry. File is not available at this time", vbInformation, "Error!"

    End Sub[/VBA]

    This works perfectly, but now having issues with it working on a Windows 7 PC.

    It appears it's failing because it's not opening the "Incoming grabber.lab" file as an administrator.

    Can someone modify this to work for windows 7?

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    Did you connect the lab extension in windows7 to a program with which it can be opened ?

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Yes, if you open the file by it's self it will open, but it would need to be opened by right clicking and selecting open as administrator

  4. #4
    i thing friends it's a issue for windows 7 compatibility so check that compatibility must be fine...

Posting Permissions

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