Hi, i'm new to this so ill try to cover as much detail as i can to avoid confusion. For my final year project i have decided to make a hardvard referencing tool using VBA. The Form has a set of radio buttons at the top with the different media options to choose from such as a book, website, newspaper etc. when a radio button is selected, the textboxes and labels below change to tell the user what they should enter in each box. now to the part im having trouble with:
when they submit their input by clicking a button, the text is output into a single cell with addition punctuation added but certain parts such as book title need to be in italics. I have found how to format part of the string but the starting position will change everytime depending on the length of the strings that come before it.
This is what i have so far but i cant get it to work
Can anybody help please?
when they submit their input by clicking a button, the text is output into a single cell with addition punctuation added but certain parts such as book title need to be in italics. I have found how to format part of the string but the starting position will change everytime depending on the length of the strings that come before it.
This is what i have so far but i cant get it to work
Can anybody help please?
Code:
ActiveCell.Value = Txt3.Value + ", " + Txt4.Value + ". (" + Txt5.Value + ") " + Txt6.Value + ". " + Txt7.Value + Txt8.Value + Txt9.Value + Txt10.Value + ": " + Txt11.Value + "."
'Finds the starting position of the text to be italicised
start1.Value = 7 + Len(Txt3.Value) + Len(Txt4.Value) + Len(Txt5.Value)
'Changes the text to italics from the starting point for the length of the string being italicised
With ActiveCell.Characters(Start:=start1.Value, Length:=txt6Len.Value).Font
.Name = "Calibri"
.FontStyle = "Italic"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Last edited by a moderator: