Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-08-2022, 11:22 AM
Rampum15 Rampum15 is offline I need to edit a macro to open *.Doc and *.Docx files Windows 10 I need to edit a macro to open *.Doc and *.Docx files Office 2019
Novice
I need to edit a macro to open *.Doc and *.Docx files
 
Join Date: Dec 2019
Posts: 8
Rampum15 is on a distinguished road
Default I need to edit a macro to open *.Doc and *.Docx files

Hello,
I'll start by saying that I do not know VBA at all, so any and all help will be GREATLY appreciated! I work in a manufacturing plant, and we have a macro that is used almost everyday to open and print *.Doc files. We are now adding bar codes to new documents to call up machine programs. The problem is that we start with a *.Docx file, but then have to save it as a *.Doc file for the macro to work. Doing this changes the bar code to an static image file, which then can not be edited. I'd like to edit our macro so that it will open both *.doc and *.docx files. I've tried several modifications to the macro with no luck. The problem always seems to come back to the file extension specified in the macro. I can change it to *.Docx, but then it doesn't work with the older files. Can someone show me how to open both types of files without specifying the extension? The section of the macro that calls the file is listed below. I'm sure it's probably a simple thing to fix, I just don't know how to do it.

Thanks in advance for your help!

Documents.Open FileName:="Z:\Travellers" & File & ".doc", _
ConfirmConversions:=False, ReadOnly:=True, AddToRecentFiles:=False, _


Revert:=False, Format:=wdOpenFormatAuto, XMLTransform:=""
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot open files created in Word/show up as DOCX Alcore Office 4 10-24-2021 02:08 AM
I need to edit a macro to open *.Doc and *.Docx files View and edit docx files in Word 2003 orealius Word 4 03-16-2019 08:11 AM
I need to edit a macro to open *.Doc and *.Docx files I cannot open .docx files even though I have MS Office 2016 syeh11 Word 1 09-14-2015 10:16 PM
How to open Docx files? mond_bees Word 12 08-29-2012 03:32 AM
Office 2007 will not open .docx files Reg1987 Word 1 12-15-2010 11:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:43 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