Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2011, 05:26 PM
Joe Patrick Joe Patrick is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2007
Advanced Beginner
How to make Word NOT ConfirmConversion with VBA
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default How to make Word NOT ConfirmConversion with VBA

Hi,



I'm opening the word doc from Excel. The doc is set to not ask for conversion upon opening but it does anyway when opening with VB code.

Here's my code:

Code:
Sub PopulateWord()
Dim appWD As Word.Application
 
Set appWD = CreateObject("Word.Application")
Sheets("By Event Name").Select
If Range("B2").Value = "" Then
  Range("A1").Select
  Range(Selection, Selection.End(xlToRight)).Select
  Selection.Copy
Else
  Range("A1").Select
  Range(Selection, Selection.End(xlToRight)).Select
  Range(Selection, Selection.End(xlDown)).Select
  Selection.Copy
End If
Application.DisplayAlerts = False
appWD.Documents.Open "U:\TPCentral_Too\Templates\PD_HO_Announcement\PD_HO_Announcement2.htm", ConfirmCoversions = False
appWD.Selection.WholeStory
appWD.Selection.Delete Unit:=wdCharacter, Count:=1
appWD.Selection.Paste
Application.DisplayAlerts = True
appWD.ActiveDocument.Save
appWD.ActiveDocument.Close
appWD.Quit
End Sub
I tried this but get a compile error, named argumetn not found:


Code:
"U:\TPCentral_Too\Templates\PD_HO_Announcement\PD_HO_Announcement2.htm", ConfirmCoversions:=False
Can anyone help me with this, please?

Last edited by Joe Patrick; 07-23-2011 at 05:39 AM. Reason: Added code tags
Reply With Quote
  #2  
Old 07-23-2011, 01:46 AM
macropod's Avatar
macropod macropod is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Hi Joe,

Instead of 'ConfirmCoversions = False' you should have 'ConfirmCoversions:=False'. Your code could also be made more efficient:
Code:
Sub PopulateWord()
Dim appWD As Word.Application
Set appWD = CreateObject("Word.Application")
With Sheets("By Event Name")
  If Range("B2").Value = "" Then
    Range("A1", Range("A1").End(xlToRight)).Copy
  Else
    Range("A1", Range("A1").End(xlToRight).End(xlDown)).Copy
  End If
End With
With appWD
  .DisplayAlerts = False
  .Documents.Open FileName:="U:\TPCentral_Too\Templates\PD_HO_Announcement\PD_ HO_Announcement2.htm", ConfirmCoversions:=False
  With .ActiveDocument
    .Range.Delete
    .Range.Paste
    .Close SaveChanges:=True
  End With
  .DisplayAlerts = True
  .Quit
End With
End Sub
Note: When posting code, please use code tags.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 07-24-2011 at 04:35 PM.
Reply With Quote
  #3  
Old 07-23-2011, 05:31 AM
Joe Patrick Joe Patrick is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2007
Advanced Beginner
How to make Word NOT ConfirmConversion with VBA
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default

Paul, thank you so much for helping me with my code again!

Unfortunately, I'm still getting the compile error mentioned in my original post. Any suggestions?
Reply With Quote
  #4  
Old 07-23-2011, 03:34 PM
macropod's Avatar
macropod macropod is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Hi Joe,

Try using:
.Documents.Open "U:\TPCentral_Too\Templates\PD_HO_Announcement \PD_ HO_Announcement2.htm", False, False, False
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-23-2011, 04:17 PM
Joe Patrick Joe Patrick is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2007
Advanced Beginner
How to make Word NOT ConfirmConversion with VBA
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default

Ug, now it's a compile error, expected: named parameter
Reply With Quote
  #6  
Old 07-23-2011, 10:26 PM
macropod's Avatar
macropod macropod is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Hi Joe,

That should only occur if one of the paramenters is named and another isn't. Did you delete the 'FileName:=' as well?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 07-24-2011, 06:12 AM
Joe Patrick Joe Patrick is offline How to make Word NOT ConfirmConversion with VBA Windows 7 64bit How to make Word NOT ConfirmConversion with VBA Office 2007
Advanced Beginner
How to make Word NOT ConfirmConversion with VBA
 
Join Date: May 2011
Posts: 33
Joe Patrick is on a distinguished road
Default

Sorry, I missed that. Thank you again for helping me with this!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make Word NOT ConfirmConversion with VBA How do I make a check box in a text box in Word? VSCD Word 2 06-15-2011 10:09 AM
How to make Word NOT ConfirmConversion with VBA Using replace to make a word bold and its proceeding character. bostonboi Word 1 01-16-2011 01:54 PM
Make text permanent in Microsoft Word 2010, how? shaunzo101 Word 0 09-21-2010 08:27 PM
Can I Extract a Page from Word and Make a New DOCX File? tatihulot Word 1 06-20-2010 11:38 PM

Other Forums: Access Forums

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