PDA

View Full Version : [SOLVED:] eliminate question mark box when enter key is pressed



tarekgemayel
07-15-2014, 01:53 AM
Hello,

I created a userform where the user enters text in an enabled multi-line textbox.
The text is then sent to a cell in excel where the worksheet is then converted to PDF.

At every place where the "enter" key has been pressed in the textbox i get a small question mark box in the PDF document.
However that small question mark box is visible in the sheet cel where the text has been copied.

I want to eliminate that small question mark box from the PDF file. How can i do that?

snb
07-15-2014, 03:05 AM
You can't.
You can only remove the nonprintable characters in Excel.

tarekgemayel
07-15-2014, 03:20 AM
ahhh!! that really is a bummer!
thx though

westconn1
07-15-2014, 02:27 PM
did you try to replace the ? with ""

cell = replace(textbox, "?", "")

you may find that the ? is a special character and need to change to the chr() to match

Paul_Hossler
07-15-2014, 02:36 PM
The [?] is probably the line feed, or carriage return (ascii or ascii 13) since you said it happens where you hit Enter, or it might be font dependent

can you post a small example?

tarekgemayel
07-15-2014, 10:28 PM
The [?] is probably the line feed, or carriage return (ascii or ascii 13) since you said it happens where you hit Enter, or it might be font dependent

can you post a small example?

Please find the attached JPEG screenshot of the section with the problem shown in the 'Note' section.
Yes the [?] comes from the carriage return (char(10) or char(13)) as you said.
Please any help is truly appreciated :)

GTO
07-15-2014, 10:54 PM
...I created a userform where the user enters text in an enabled multi-line textbox.
The text is then sent to a cell in excel where the worksheet is then converted to PDF...

Could you attach a file that replicates what is happening in code now? The picture doesn't really show us what the code is doing.

Mark

tarekgemayel
07-15-2014, 11:05 PM
There is no code for that specific section. All i have is a textbox with multi-line enabled in a userform.
The text entered in that textbox will be copied to merged cells on an excel sheet.
Then the sheet is exported as PDF.

The multi-line is enabled from the textbox's properties.

mancubus
07-16-2014, 01:00 AM
when testing, hitting enter key after typing in multiline textbox just confirmed the entry and sets the focus to the next control.

am i missing something?

posting your workbook will help users help you.

westconn1
07-16-2014, 01:16 AM
even if you copy a cell content and paste it into a post, we should be able to determine the character

tarekgemayel
07-16-2014, 02:00 AM
I wish i could post my workbook, but it has confidential information i cannot disclose.
The [?] box does not appear in the excel Cell before converting to PDF. (as seen in excel-view attachment)
it will only appear once i convert to PDF. (as seen in this is a test attachment)

PS: The [?] box is located in the "Note" section at the end of the sheet.

Here is a section of my code that creates the range on the Sheet and then copies the data from the textbox to the merged cells:


'Set the Note section from A11:G17 and merge cells then copy the multi-line text from the textbox
Range("A" & row + 10).Font.Bold = TrueRange("A" & row + 10).Font.ColorIndex = 3
Range("A" & row + 10).Value = "Note:"
Range("A" & row + 11 & ":G" & row + 17).Select
With Selection
.ClearContents
.Merge
.WrapText = True
.Font.Size = 9
.VerticalAlignment = xlTop
.Value = NoteBox.Value
End With




Here is the section of my code that converts to PDF


With Worksheets("OutputList")
namefile3 = .Range("G6") & ".pdf"
End With
namefile3 = Application.GetSaveAsFilename(InitialFileName:=Environ("USERPROFILE") & "\Desktop\" & "File Name Cannot Be Changed (Quotation Number Will Be Automatically Used As File Name)", Title:="Save Quote as PDF", filefilter:="PDF File (*.pdf), *.pdf")
If namefile3 = False Then
MsgBox "File Not Saved"
Else
ActiveSheet.Range("A1:G" & row + 18).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
namefile, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Sheets("OutputList").Visible = xlSheetHidden
End If

snb
07-16-2014, 02:12 AM
Avoid any use of merged cells !

No one asks to post a file containing sensitive information. Post a sample workbook that illustrates your question.

tarekgemayel
07-16-2014, 02:31 AM
Avoid any use of merged cells !

Ahhhh ok i see. I will try to eliminate the merged cells and see whether it'll work.
Thanks. Ill also work on a primitive template for you to check.

Thanks again

tarekgemayel
07-16-2014, 03:17 AM
Alright. It seems that the Merged Cells has nothing to do with this.
Even without the merged cells i still get the [?] box.
Now ill work on a sample workbook for you to test

tarekgemayel
07-16-2014, 03:42 AM
Avoid any use of merged cells !

No one asks to post a file containing sensitive information. Post a sample workbook that illustrates your question.

Alright here is a sample workbook that illustrates my problem.
Please fill in the Textbox and then click Confirm. Make sure you include carriage returns.
After that try saving the Sheet into PDF.
You will see the [?] appear at every carriage return.

Thanks

Bob Phillips
07-16-2014, 03:44 AM
After posting the textbox to the worksheet, try replacing the carriage returns by a nullstring, like so


Range("A5").Value = Me.TextBox1.Text
Range("A5").Value = Replace(Range("A5").Value, Chr(13), "")


I was able to replicate your problem, that fixed it for me.

tarekgemayel
07-16-2014, 04:02 AM
After posting the textbox to the worksheet, try replacing the carriage returns by a nullstring, like so


Range("A5").Value = Me.TextBox1.Text
Range("A5").Value = Replace(Range("A5").Value, Chr(13), "")

I was able to replicate your problem, that fixed it for me.

Alright. I can see what you are doing here. But please could you apply it to the workbook that i attached below. I am not capable of doing it.
Thanks alot

Bob Phillips
07-16-2014, 04:38 AM
Here it is 11964

You really should avoid merged cells, they are so unnecessary.

tarekgemayel
07-16-2014, 04:40 AM
Alright I did exactly what 'xld' proposed. I first copied the data from the textbox to a single Cell which allowed me eliminate the Char(13) carriage return.
Then i copy/pasted the text from that Cell to my Merged Cells and cleared the content from the Cell.

It works fine. Thank you XLD. :clap::clap::clap::):)

Bob Phillips
07-16-2014, 11:28 AM
What was wrong with the workbook I posted?

tarekgemayel
07-16-2014, 11:34 AM
What was wrong with the workbook I posted?

Actually the Workbook you presented is perfect! I did not have the chance to thank you for it!
I really appreciate it :) thank you very much