Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #31  
Old 08-23-2012, 05:34 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

I have worked out the reason. Its just that when word opens a document downloaded from internet - it opens in non editing mode and we have to click "Enable Content" and hence the reasdon it cannot recognise the document is open and cannot run the macro (at open macro).



Regards
Reply With Quote
  #32  
Old 08-23-2012, 05:36 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Another issue

Hi Paul,

Sorry to ask this again, I am just trying to make it work.

Now it is giving the error "Style not found". I thought something should be wrong with the style name, however when I clicked on the Debug, the error was on some other line. See the attached image and code is below
Code:
Sub Document_Open()
Dim StrSty As String, i As Long
StrSty = "Custom Breakout,Custom Breakout Subheading,Custom Page Heading," & _
  "Custom Page Subheading 1.0,Table Grid, Umesh Table"
With ActiveDocument
  With .Content.find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Text = "monitor"
    .Replacement.Text = "review"
    .Execute Replace:=wdReplaceAll
    .Text = "folder or on a seperate disc"
    .Replacement.Text = "folder"
    .Execute Replace:=wdReplaceAll
  End With
  If InStr(.Sections.First.Footers(wdHeaderFooterFirstPage).Range.Text, "Statement of Advice") > 0 Then
    For i = 0 To UBound(Split(StrSty, ","))
      Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
        Name:=Split(StrSty, ",")(i), Object:=wdOrganizerObjectStyles
    Next
  End If
End With
End Sub
Attached Images
File Type: png Macro Issue.PNG (38.0 KB, 12 views)
Reply With Quote
  #33  
Old 08-23-2012, 05:38 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Quote:
I have worked out the reason. Its just that when word opens a document downloaded from internet - it opens in non editing mode and we have to click "Enable Content" and hence the reasdon it cannot recognise the document is open and cannot run the macro (at open macro).
That's just a matter of downloading the file before opening it (rather than opening it from the internet) and using the correct security settings, including (if applicable) trusted locations.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #34  
Old 08-23-2012, 05:38 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

It seems to be working now.

I am going to reinstall word.
Reply With Quote
  #35  
Old 08-23-2012, 05:41 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Quote:
Originally Posted by ubns View Post
Hi Paul,

Sorry to ask this again, I am just trying to make it work.

Now it is giving the error "Style not found". I thought something should be wrong with the style name, however when I clicked on the Debug, the error was on some other line.
In all likelihood, it's because the template the code looks at isn't your's anymore, but the user's.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #36  
Old 08-23-2012, 05:43 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Quote:
Originally Posted by ubns View Post
I am going to reinstall word.
I can't see that resolving anything. If there is a Word error (unlikely from anything you've described), reinstalling is unlikely to fix it any better than a repair would.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #37  
Old 08-23-2012, 06:01 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

oh Ok.

I will do repair.
Reply With Quote
  #38  
Old 08-29-2012, 05:11 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Macro not working

Hi,

I have done all the repair etc.

I have changed the settings of protected mode.

See attached images - I have numbered them in sequence 1,2,34.

Please advice what else could be done - for macro to work at start.

Regards
Attached Files
File Type: zip Macro Images.zip (160.3 KB, 10 views)

Last edited by ubns; 08-29-2012 at 05:15 PM. Reason: Forgot Attachment
Reply With Quote
  #39  
Old 08-29-2012, 08:36 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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 Umesh,

As I said before, a Word error was unlikely from anything you've described. So I don't know why you've done a repair or changed various settings.

The first issue to address is why Word detects a problem in the 'reportout' document. For example, is it a valid Word file, or has someone just opened it in Word without checking?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #40  
Old 08-29-2012, 08:43 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Ok thanks, so how do you suggest I address that issue.
Reply With Quote
  #41  
Old 08-29-2012, 09:19 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Well, you could start with the checks I suggested. After all, I have no idea what your 'reportout' document is. The image you posted doesn't indicate a doc(x/m) extension - or any other, for that matter - and I don't even know if it's in a format that Word recognizes.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #42  
Old 08-30-2012, 05:11 AM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

Thanks. What checks you are referring to. FYI the document is .doc type.
Reply With Quote
  #43  
Old 08-30-2012, 06:10 AM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

How do you know it's a doc type? Simply adding a 'doc' extension does not make it one. the error message suggests Word does not think it is a valid doc type.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #44  
Old 09-04-2012, 06:54 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
How do you know it's a doc type? Simply adding a 'doc' extension does not make it one. the error message suggests Word does not think it is a valid doc type.
Hi Paul,

Then how can I determine the file type? Can you please suggest something on that?

Regards
Reply With Quote
  #45  
Old 09-04-2012, 08:17 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

I suspect it may be just a plain text file, in which case the content will be readily visibly in Notepad.

A genuine Word Doc file, when viewed with a text editor (eg notepad) begins with the character Ð. There are many other conditions but, if the Ð isn't present, whatever else it might be it's not a Doc file.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to replace one specific heading style with another Create and save custom heading style ubns Word 3 08-01-2012 09:42 PM
Macro to replace one specific heading style with another Modify a numbered heading style TheQueenBea Word 3 06-05-2012 12:12 PM
Macro to replace one specific heading style with another Changing numbering in a Heading style TheQueenBea Word 1 05-31-2012 02:22 PM
Macro to replace one specific heading style with another Very frequent heading style, but still not built in Word!!!!! why??? Jamal NUMAN Word 17 06-30-2011 05:47 PM
How to have this Heading – Table of contents style? Jamal NUMAN Word 0 01-13-2011 06:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:17 PM.


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