Drop cap

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

.................go for it bro. let me know if the sequence I mentioned above is easy to follow.....Dave up in the shivering morth east of UK.

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

New hurdle :- When I positioned the cursor on the first line of an article [on the word Relationships in this case] then hit the assigned keyboard shortcut keys for a dropped cap I got this error message, but the code shown when I select the "Debug" tab means nothing to me. Why would this error occur and what changes if any need to be made to the [line of code in red?] I should have said that the first letter did not turn to a dropped cap. Puzzled again.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 80042
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Drop cap

Post by HansV »

The macro will only work if the paragraph containing the selection has at least one character. You'll get the error message if the paragraph is empty.
If it's empty, there is nothing to drop...
Best wishes,
Hans

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

I appreciate that Hans but the cursor was positioned over the first word as at othefr times when it worked just fine. Thanks.

User avatar
HansV
Administrator
Posts: 80042
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Drop cap

Post by HansV »

I cannot explain that, sorry.
Best wishes,
Hans

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

as the Ausies would say; "No worries mate" it is after all not anything to sweat about being just a slight enhancement of the text, besides, it works most of the time. Regards Dave.

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

Further to this last post, I have not used the macro I created for quite some time but now for some unknown reason when I do using the keyboard shortcut I assigned Ctrl+Shift+M, it fails showing the error message shown. How can this anomally be rectified please. :scratch: :thankyou:
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 80042
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Drop cap

Post by HansV »

Does it work better if you change the macro code to

Code: Select all

Sub MyDropCap()
    With Selection.Paragraphs(1)
        If Len(.Range.Text) > 1 Then
            With .DropCap
                .Position = wdDropNormal
                .FontName = "Castellar"
                .LinesToDrop = 2
                .DistanceFromText = 3 ' in points
            End With
        End If
    End With
End Sub
Best wishes,
Hans

User avatar
Charles Kenyon
5StarLounger
Posts: 676
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Drop cap

Post by Charles Kenyon »


User avatar
ChrisGreaves
PlutoniumLounger
Posts: 16789
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Drop cap

Post by ChrisGreaves »

LineLaline wrote:
24 Dec 2022, 16:22
... In fact, back in the 'old days' when they were 'terribly dangerous' one of the first things I did after installing Office was turning off all macro functionality.
You are not alone. Back in 2012 I was hired by the CIBC bank in Toronto. I was hired to write VBA code and had been recommended by an earlier client of mine. After five weeks of stuttering activity the project leader terminated the contract because Senior Management had caught whiff of the project, and back when Senior Management were younger, they had lived through the tainted normal.dots of the early 1990s.
In their minds VBA was bad because that was programming in MSOffice.
I never did find out how the CIBC developed an interface between their documents and their data.

Please don't get too paranoid, or you'll end up like me :grin:

Cheers, Chris
Fill your face with laughter, then there will be no room for tears.

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

This is the only template where an answer can be written though it does not appear at the end of your post Hans! I copied and pasted the code you supplied which works if I click on the Insert / Macros / Run tabs but not when using the keyboard shortcut keys I originally assigned! Might just create a new one. Thanks Dave.

User avatar
HansV
Administrator
Posts: 80042
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Drop cap

Post by HansV »

You can re-assign the keyboard shortcut to the new macro.
Best wishes,
Hans

User avatar
Dave Davison
SilverLounger
Posts: 1881
Joined: 27 Jan 2010, 19:15
Location: Darlington, Co. Durham. UK

Re: Drop cap

Post by Dave Davison »

Thanks Hans, I've tried to make a new macro a couple of times -using the none expert way I showed earlier in the post- but for some reason it does not work. I tried pasting the code you provided also but no joy either. Kowing next to nothing about macros I simply pasted the code you gave but I suspect it represents only part of what's needed as it does not work. If so, is it possible for you to create and post the entire code with e.g. the shortcut keys being [alt gr + \]? Kind regards Dave.

User avatar
HansV
Administrator
Posts: 80042
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Drop cap

Post by HansV »

No, I cannot create a shortcut for you, sorry.
Best wishes,
Hans

snb
5StarLounger
Posts: 670
Joined: 14 Nov 2012, 16:06

Re: Drop cap

Post by snb »

Why not putting the dialog wdformatdropcap in the QAT ?
1 click to open the dialog, 1 clickt ro adapt 3 into 2, 1 click to close the dialog.
You do not have the required permissions to view the files attached to this post.

User avatar
Charles Kenyon
5StarLounger
Posts: 676
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Drop cap

Post by Charles Kenyon »

Dave Davison wrote:
06 Feb 2025, 15:34
Thanks Hans, I've tried to make a new macro a couple of times -using the none expert way I showed earlier in the post- but for some reason it does not work. I tried pasting the code you provided also but no joy either. Kowing next to nothing about macros I simply pasted the code you gave but I suspect it represents only part of what's needed as it does not work. If so, is it possible for you to create and post the entire code with e.g. the shortcut keys being [alt gr + \]? Kind regards Dave.