helppppp plzzz :(

hatemhatem

New Member
Joined
Mar 1, 2010
Messages
21
i have a problem and i hope you can help me, i have a workbook (pr-pri check 2.3.xls) it's stored in my laptop, and i should download from the server 2 other xls file whitch i will need them in my macro (these two file must be opened) my macro is like this :

Code:
Sub lock()
Dim ff As Integer
Dim strFile As String
Dim strBuffer As String
Dim pr As Workbook, pri As Workbook, pr_pri As Workbook
Dim wspr As Worksheet, wspri As Worksheet, wspr_pri As Worksheet
Set pr = Workbooks("PR_DETAIL(GD330_ANLDSV).xls")
Set pri = Workbooks("GD330AT-00-V10o-204-XX-JAN-12-2010+0_PRI.xls")
Set pr_pri = Workbooks("PR-PRI Check 2.3.xls")
Set wspr = pr.Worksheets("PR_DETAIL(GD330_ANLDSV)")
Set wspri = pri.Worksheets("PRI DATA")
Set wspr_pri = pr_pri.Worksheets("Feuil1")
Workbooks("PR_DETAIL(GD330_ANLDSV).xls").Activate
Workbooks("GD330AT-00-V10o-204-XX-JAN-12-2010+0_PRI.xls").Activate
Workbooks("PR-PRI Check 2.3.xls").Activate
 
 
strFile = "C:\Program Files\teraterm\code.txt"
ff = FreeFile
strBuffer = wspri.Range("F29").Value
Open strFile For Binary Access Write As #ff
Put #ff, , strBuffer
Close #ff
 
strFile = "C:\Program Files\teraterm\type.txt"
ff = FreeFile
strBuffer = wspri.Range("F33").Value
Open strFile For Binary Access Write As #ff
Put #ff, , strBuffer
Close #ff
 
End Sub

my problem is in line 8 and 9 when i must write the name of the two xls file in my macro but the name of the two file change in the server, it is not the same fo example his name is "PR_DETAIL(GD330_ANLDSV).xls" but another time his name will change :s
how can i have a genaral case not specific for the tow file??????

hope i m clear i you can help me
 
Last edited by a moderator:

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