0 votes
in VBA by Beginner (48 points)
edited by

hi, 

actually i  got  the  code  and   add some  lines   to  what  i  need    as  you   see the  code   i  add  some  message   when  i  search   the  files   so   in the   begining   if    the  inputbox   is empty   the   it  shows   message  tell me   you  don't  write   the  file name   and  if  is not    found   in  the  specefic  folder   it  shows   message    the  file  is not  existed   and   if   the   file   is

existed   so  show  message   two  choice    i  open  the   file   or  not   but  before  it   show message  contain  two  choice    i  would  give  me  message  show   data   about  file   like   the  name   and   the  type   and  size

i  hope   somebody help

 

Sub LoopThroughFiles1()
 
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer
Set oFSO = CreateObject("Scripting.FileSystemObject")
 
Set oFolder = oFSO.GetFolder("C:\Users\ALHAGAG\Desktop")
file = InputBox("in which file do you wish open  data ? specify file name ", "file name")
If file = "" Then
MsgBox "you didn't write a file name !"
Exit Sub
End If
If file <> oFolder Then
MsgBox "the  file  is not  existed!"
Exit Sub
End If

If file = oFolder Then
answer = MsgBox("are you sure want to add the file name?", vbYesNo + vbQuestion, "add file  name")
End If
If answer = vbYes Then

("11\oFSO.Open ("C:\Users\ALHAGAG\Desktop     
End If
 

 
End Sub

   

Please log in or register to answer this question.

Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
Register
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

Looking for something else? Hire our professional VBA Help, instead.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

ParserMonster $25 Amazon Gift Card
Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.

Register

For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.

...