Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2019, 09:25 AM
Rampum15 Rampum15 is offline Macro now requires file extension entered to open document Windows 10 Macro now requires file extension entered to open document Office 2019
Novice
Macro now requires file extension entered to open document
 
Join Date: Dec 2019
Posts: 7
Rampum15 is on a distinguished road
Default Macro now requires file extension entered to open document

Hello, Let me start by stating that I do not know VBA, but I am considered the troubleshooter when something goes wrong. I work for a small manufacturer, and we create a document for each part that outlines what needs to be done. We have a relatively simple macro that we have been using for the last 11 or 12 years. It basically opens a document, then uses find and replace to change a couple of text fields, prints and closes it without saving. The document is opened by entering the file name only with no file extension. Up until this week it was working perfectly, but now the only way to get it to work is to enter the filename AND the extension. It seems a recent office update has changed something to cause this. This was discovered accidently by trying the macro on another computer and it worked without entering the file extension. We discovered that PC has office version 16.0.8431.2153, and the other PC has version 16.0.11328.20392. Having to enter an additional 4 keystrokes is cumbersome and time-consuming. I'm hoping that someone can advise me on how to get the macro to work as it has previously. I've attached the complete macro for review, and lastly, the documents we use are all in Word97 format (*.doc). Thank you for your help!
Attached Files
File Type: txt Traveller-Macro.txt (2.7 KB, 6 views)
Reply With Quote
  #2  
Old 12-06-2019, 08:21 PM
macropod's Avatar
macropod macropod is offline Macro now requires file extension entered to open document Windows 7 64bit Macro now requires file extension entered to open document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the following simplified version of your macro:
Code:
Sub Travellers()
    MsgBox ("IS FINEPRINT SET AS THE DEFAULT PRINTER?")
    fsDT = InputBox("Due Date is...", "Due Date", "DUE DATE")
    If File = "quit" Then Num = 1 Else Num = 0
    Do While Num = 0
        fsWON = InputBox("Enter Work Order Number or press Cancel to exit", "Work Order #", "Work Order Number")
        If fsWON = "" Then Exit Do
        File = InputBox("Name of the Part File to open?", "Open File", "Part Number")
        QTY = InputBox("Order Quantity is...", "Order Quantity", "Quantity")
        Documents.Open FileName:="S:\Word\Parts\" & File & ".doc", _
            ConfirmConversions:=False, ReadOnly:=True, AddToRecentFiles:=False, _
            Revert:=False, Format:=wdOpenFormatAuto, XMLTransform:=""
        With ActiveDocument
            With .Find
                .ClearFormatting
                .Replacement.ClearFormatting
                .Forward = True
                .Wrap = wdFindContinue
                .Format = False
                .MatchCase = False
                .MatchWholeWord = False
                .MatchWildcards = False
                .MatchSoundsLike = False
                .MatchAllWordForms = False
                .Text = "WRKORD"
                .Replacement.Text = fsWON
                .Execute Replace:=wdReplaceAll
                .Text = "QTY"
                .Replacement.Text = QTY
                .Execute Replace:=wdReplaceAll
                .Text = "DDT"
                .Replacement.Text = fsDT
                .Execute Replace:=wdReplaceAll
            End With
            .PrintOut Background = True
            .Close SaveChanges:=wdDoNotSaveChanges
        End With
    Loop
End Sub
Note, particularly, the Documents.Open line.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-09-2019, 06:19 AM
Rampum15 Rampum15 is offline Macro now requires file extension entered to open document Windows 10 Macro now requires file extension entered to open document Office 2019
Novice
Macro now requires file extension entered to open document
 
Join Date: Dec 2019
Posts: 7
Rampum15 is on a distinguished road
Default

SUCCESS! Thank you Paul! I really appreciate your help! I also appreciate that you shortened it! Just an FYI - the original macro was first written back in 2007, so we have become pretty dependent on it. Have a great week!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
OneNote requires interent access to open??? rasmasyean OneNote 0 02-13-2017 01:59 PM
Macro now requires file extension entered to open document Macro to Open to a Website When No Document Is Open lostinwebspace Word VBA 1 02-13-2016 10:28 AM
File extension issues lkernen Excel 11 11-12-2013 01:17 PM
Macro now requires file extension entered to open document excel cannot open the file .xlsx because the file format or file extension is not val teddysika Excel 1 11-22-2012 06:06 AM
Getting COMException Incompatible file type and file extension sbalerao Mail Merge 0 04-21-2011 10:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:32 AM.


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