PDA

View Full Version : Windows 7 external file open



Emoncada
04-26-2012, 11:44 AM
I have the following code

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

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?

snb
04-26-2012, 02:01 PM
Did you connect the lab extension in windows7 to a program with which it can be opened ?

Emoncada
04-27-2012, 10:28 AM
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

adamstuart07
06-26-2012, 05:24 AM
i thing friends it's a issue for windows 7 compatibility so check that compatibility must be fine...