Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2011, 11:02 AM
ACA ACA is offline Opening/Saving dialogue box Windows 7 Opening/Saving dialogue box Office 2007
Advanced Beginner
Opening/Saving dialogue box
 
Join Date: Aug 2010
Posts: 31
ACA is on a distinguished road
Default Opening/Saving dialogue box


In a macro for WORD I want some code that will show the file opening dialogue box; so that, once there, I can choose the particular document I need and open it (then the macro will go on to execute other lines) - the equivalent to, in EXCEL
Code:
Application.FindFile
.

Same thing for saving: some code that will show the file saving dialogue box; once there, I will give my document the name I want and choose a directory to save it in (then the macro will go on running lines).

In the VB aid from WORD I see only code that already includes the name of one file; and of course, only that one file can get opened/saved with such code.
Thanks for any help
ACA
Reply With Quote
  #2  
Old 08-03-2011, 02:01 AM
ACA ACA is offline Opening/Saving dialogue box Windows 7 Opening/Saving dialogue box Office 2007
Advanced Beginner
Opening/Saving dialogue box
 
Join Date: Aug 2010
Posts: 31
ACA is on a distinguished road
Default

Solution for opening files.
I’ve found some code, originally for filtering files, that does open them.
After pruning off several lines not needed for just one file, I am left with the macro below, that works O.K.

Now, I don’t need the “For Next” loop, as I am opening just one file each time I run the macro. But the line in the middle, by itself, is not accepted; it must be altered in some way that I don’t know.
Any help with just that, please? Thanks a lot.
ACA

Code:
 
Sub Macro1()
'
' Macro1 Macro
 
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
 
    Dim vrtSelectedItem As Variant
    fd.Filters.Clear
        If fd.Show = True Then
 
            For Each vrtSelectedItem In fd.SelectedItems
            Documents.Open FileName:=vrtSelectedItem   ‘How must this line be altered so that it'll work by itself, without the loop?.
            Next vrtSelectedItem
 
        End If
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening/Saving dialogue box Suggestion: we need a detailed dialogue box that shows in one place all the effects a Jamal NUMAN Word 1 06-24-2011 03:52 AM
Opening/Saving dialogue box Cannot access Mailing Labels - dialogue box comes up as below Qwerty Office 3 03-26-2011 07:41 PM
Saving VBA skib PowerPoint 0 02-18-2011 12:59 AM
Opening/Saving dialogue box Stuck in cycle of name/password dialogue box originale Outlook 18 09-25-2009 03:02 PM
problem with a saving doc grigdordik Office 0 08-06-2009 07:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft