I'm a complete code novice - can someone help with two problems I'm having since upgrading to Excel 2007?
I understand that FileSearch is no longer used in Excel - how can I rewrite this code to work?
Private Sub CommandButton2_Click()
Dim x As String
Dim y As String
Dim z As String
z = ActiveSheet.Cells(2, 6).Value
x = ActiveSheet.Cells(1, 6).Value
x = x & ".pdf"
y = ActiveSheet.Cells(3, 6).Value
Set fs = Application.FileSearch
With fs
.LookIn = z
.Filename = x
If .Execute > 0 Then
ActiveWorkbook.FollowHyperlink Address:=, _
NewWindow:=True
Else
MsgBox "No signature files were found."
End If
End With
End Sub
Also, how can I change this code to refresh the Active sheet only? At the moment it refreshes all sheets
Private Sub CommandButton3_Click()
Range("A5").Select
ThisWorkbook.RefreshAll
End Sub
I've spent hours trying to figure these out with no success - Help appreciated - Thanks <!-- / message --><!-- BEGIN TEMPLATE: ad_showthread_firstpost_sig --><!-- END TEMPLATE: ad_showthread_firstpost_sig --><!-- edit note -->
I understand that FileSearch is no longer used in Excel - how can I rewrite this code to work?
Private Sub CommandButton2_Click()
Dim x As String
Dim y As String
Dim z As String
z = ActiveSheet.Cells(2, 6).Value
x = ActiveSheet.Cells(1, 6).Value
x = x & ".pdf"
y = ActiveSheet.Cells(3, 6).Value
Set fs = Application.FileSearch
With fs
.LookIn = z
.Filename = x
If .Execute > 0 Then
ActiveWorkbook.FollowHyperlink Address:=, _
NewWindow:=True
Else
MsgBox "No signature files were found."
End If
End With
End Sub
Also, how can I change this code to refresh the Active sheet only? At the moment it refreshes all sheets
Private Sub CommandButton3_Click()
Range("A5").Select
ThisWorkbook.RefreshAll
End Sub
I've spent hours trying to figure these out with no success - Help appreciated - Thanks <!-- / message --><!-- BEGIN TEMPLATE: ad_showthread_firstpost_sig --><!-- END TEMPLATE: ad_showthread_firstpost_sig --><!-- edit note -->