Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2018, 05:23 AM
gmayor's Avatar
gmayor gmayor is offline Word VBA: Open and work with a different doc from userform? Windows 10 Word VBA: Open and work with a different doc from userform? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


Your process is a bit vague but presumably you will get the office (here a string strOffice) from the userform, so something along the lines of:



Code:
Dim oDoc As Document
Dim strOffice As String

    Select Case strOffice
        Case "London"
            Set oDoc = Documents.Add("c:\path\London templatename.dotm")
        Case "New York"
            Set oDoc = Documents.Add("c:\path\NY templatename.dotm")
            'etc
    End Select
    'do stuff with oDoc
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Userform once and apply the same selection to multiple documents Formd Word VBA 2 12-12-2017 10:11 AM
Problem with add-ins that don't work that I can't delete b/c Excel, Word, etc won't open bcs Office 3 02-25-2016 03:37 PM
Powerpoint Userform sharing across all open presentations James Kreiner PowerPoint 2 09-24-2014 09:52 AM
Word VBA: Open and work with a different doc from userform? Workaround to have UserForm open from Web Link Kirsti Word VBA 11 08-23-2012 07:05 PM
Word VBA: Open and work with a different doc from userform? Text created in Work 2010- will not open in Word 2007 Ole Sarge Word 1 05-27-2011 03:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 PM.


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