View Full Version : open a folder in Excel from Word
northernstar
08-24-2007, 03:16 PM
hi everyone
i have wrote the code to open a particular folder in Word, now i would like to open a particular folder in Excel from Word
not sure how to go about this
any help would be very much appreciated
thanks
mdmackillop
08-25-2007, 02:11 AM
Folders are not in Excel or Word. Do you want to open and manipulate a workbook?
fumei
08-26-2007, 10:26 PM
northernstar, please, please, state your questions as accurately as possible. We are not mind readers. You must clearly ask questions. I can make a probable guess as to what you mean, but it is not up to me (or anyone else) to make guesses about what you mean.
Please say what you mean.
northernstar
08-27-2007, 02:43 PM
i will try and clear up this problem so that i can achieve the help i require
the users who will be using the code will normally be using word but sometimes they will need to use excel......
so i would like to switch from word to excel (or to open excel if it is not already open) and then for the file open dialogue box to be brought up into a particular folder so the user can select an excel file to open and then use
hope this helps, if any further information is required please let me know
thanks again
mdmackillop
08-27-2007, 02:50 PM
Try this (http://vbaexpress.com/kb/getarticle.php?kb_id=801) which takes you to the folder of the active document/workbook.
northernstar
08-28-2007, 11:37 AM
i thought i had made my question clearer but it seems i have not
so i will try again....here gones
basically i would like a macro in Word which switches to Excel and then gives the user the option of opening a number of files from a folder, the user may choose different file each time or the same one
hope this is clearer now??
any questions please let me know
thanks
mdmackillop
08-28-2007, 12:16 PM
Sub xx()
'Requires a reference to Microsoft Excel
Dim XL As New Excel.Application
Set XL = CreateObject("Excel.Application")
XL.Visible = True
XL.Dialogs(xlDialogOpen).Show
End Sub
northernstar
08-28-2007, 01:18 PM
hi
just tried that piece of code and it comes up with the following complie error message:
user-defined type not defined
i am am guessing this has something to do with your comment
'Requires a reference to Microsoft Excel
not quite sure what you meant by this (If anything)
thanks
lucas
08-28-2007, 02:03 PM
It is very important northernstar. Go to the visual basic editor of the document with your code and on the toolbar at top go to tools-references and find and check the one that says
Microsoft Excel xx.0 Object Library
the xx.0 will be a version depending on your version of excel so it might be 9.0 10.0 or 11.0 etc. doesn't matter because it is the version you have.
mdmackillop
08-28-2007, 02:03 PM
In the Visual Basic Editor,
Tools/References
Check against Microsoft Excel
lucas
08-28-2007, 02:06 PM
Beat cha by seconds....Not so old now....:devil2:
fumei
08-28-2007, 03:26 PM
not quite sure what you meant by this (If anything)"if anything"???????
Ummmm, northernstar, if Malcolm says something it more than likely DOES mean something.
If he uses the word "requires"....then that is exactly what he means.
It is your job here to answer questions when asked; AND
to ask questions when you do not understand.
That is the deal.
If you see something like "requires", and you do not know what it means, then ask. Requires means require. That means...if you do NOT have what is required, then you WILL get a failure.
So:
just tried that piece of code and it comes up with the following complie error message:EVERY TIME you try code that does not meet a requirement that someone states IS a requirement....you are wasting our time.
If you don't know what it means, then ask. Before trying code that has....a requirement. Otherwise, it will fail. Which is wasting YOUR time as well.
And as Steve mentions, this one is very important. In fact.....it is a requirement. You must understand this one.
northernstar
08-28-2007, 10:43 PM
the reason i try the code first is so that if it doesnt work then i can have a go to solve the problem myself.....which sometimes in the past i have done especially in Excel
i have found the required information
Microsoft Excel 10.0 Object Library
so how do i put this into the code?
thanks
northernstar
08-28-2007, 11:10 PM
ok i have solved the problem regrading the object library
so when it opens the dialogopen box, how do i direct that to a particular location for example
x:\Mechanical\Certificates\Standard\Torque\
i have tried the ChangeFileOpenDirectory code but it doesnt change the directory
any ideas
thanks again
mdmackillop
08-29-2007, 12:21 AM
XL.Dialogs(xlDialogOpen).Show "x:\Mechanical\Certificates\Standard\Torque"
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.