Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Create word using VBA
Moawia 

15 years ago
I have a database with 5000 client records
I setup a button in my form to create a folder for a client using the first name,Surname and Id fields in specific location ( Source folder)  and other one to view the created folder. ( both codes listed below).
I’m writing letters to those clients using word application  and my problem when I want to save the word file in a the client folder it take long time to find the client folder.
Is any way to setup a code to let me to lunch a word document in a client folder and to be saved there automatically.

RegARDS

Private Sub CreateFolder_Click()
Dim strname As String
Dim strfname As String
On Error GoTo 1
strname = MemberName
strfname = MemberFamilyName
MkDir "C:\Users\Moawia\Desktop\sOURCE\" & strname & " " & strfname & "__" & ID
MsgBox (strname & " " & strfname & "__" & ID & "  has been created successfully")
Exit Sub
1 MsgBox ("Could not create folder for this Client " & vbNewLine & "Folder may created already or " & vbNewLine & "Please check the Client's name and Client's family name.")
End Sub



Private Sub ViewFolder_Click()
Dim strname As String
Dim strfname As String
Dim path As String

On Error GoTo 1
strname = MemberName
strfname = MemberFamilyName
path = "Explorer.exe C:\Users\Moawia\Desktop\sOURCE\"
folder = strname & " " & strfname & "__" & ID
filename = path & strname & " " & strfname & "__" & ID
If Dir("C:\mainData\" & folder, vbDirectory) <> "" Then
   Shell (filename), vbMaximizedFocus
Else
    MsgBox ("Folder not exist")
End If
Exit Sub
1 MsgBox ("Could not view folder for this Client, folder may not exist.")
End Sub

Now I want to create a button to lunch Microsoft word in  



Reply from Richard Rost:

What about using the SHELL or SHELLEX commands to launch WINWORD.EXE with a parameter to load your file? I haven't tried it, but it should work.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/9/2026 8:28:02 AM. PLT: 1s