Help with FileSearch VBA Code

nat30

New Member
Joined
Feb 16, 2010
Messages
4
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:=(y), _
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 -->
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi, I'm new to the forum and I don't know how to edit my original post, which why I posted again with a different title hoping to get some urgent help
 
Upvote 0

Forum statistics

Threads
1,215,695
Messages
6,126,261
Members
449,307
Latest member
Andile

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top