open an other workbook to eddit

  • Thread starter Thread starter eyesonly1965
  • Start date Start date
E

eyesonly1965

i have a form to make an order, but i have to get an ordernumber fro
another excel workbook.
now i want to make a button to open the workbook that contains th
ordernumbers and make it the active workbook.

can anyone help me with thi
 
Try

Workbooks.Open Filename:="YourFileLocationHere"

where you file location might be as follows:
"C:\Folder1\Folder2\SubFolder1\FileName"

An easy way to make sure you get the correct file name is to do a
Record Macro when selecting the file and using that code.
 
that is what i had found out but the problem is that i can't make the
new workbook active without closing my form, and this is what i'm
trying to prevent.


thanx for the tip
 
well finaly i got it. and it works

the final code is:
-Private Sub cmdBestelnummerOpvragen_Click()

Workbooks.Open Filename:="C:\Documents and
Settings\leon\Bureaublad\groupagelijst.xls"
frmBestellijst.Hide

End Sub-

but the next problem accurred.
when i closed my ordernumber workbook, the workbook that i am working
in showed the sheet and not my form.
and this is what i'm preventing to show to the users, so when i close
my openend workbook my form should apear on top again.

i have fixed this by adding the following code to my workbook.

-Private Sub Workbook_WindowActivate(ByVal Wn As Window)
frmBestellijst.Show
End Sub
-


so now it works the way i want it, thanx for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top