Modules & VBA :: Export To Excel (rich Text) Column Not Formatting Correctly
Feb 6, 2015
I have a process that is getting data from sharepoint page, containing 2 list. Both list contain one field I am having issues in my export, a 'Multiple Lines of Text' type field which is Rich Text in sharepoint. I have an access DB with a linked table to those 2 list. Access show the one field I am having problems with as Memo.
The Linked table pulls/display the rich text data field correctly. My access query pulls/displays the data correctly.
My export procedure does not, the cell it exports to includes the HTML Tags. How can i modify my VBA export procedure to export to excel in plain text, i dont need the same format, just want to drop the html tags.
Code:
Public Sub StatusReportExport()
On Error Resume Next
' Test to see if the file currently exist, if so, delete file, so new file can be written.
Kill ("L:Connect SiteStatus Report " & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & ".xls")
If Dir("L:Connect SiteStatus Report " & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & ".xls") <> "" Then
MsgBox "Status Report.xls File already in use!" & vbNewLine & "Please Close File, then rerun Report."
[code]....
View Replies
ADVERTISEMENT
Sep 27, 2014
how I can set a color on table column formatted as rich text and memo. For instance this table has 4 different columns of remarks, one from each engineering operating center. Remarks_1, Remarks_2, Remarks_3 and Remarks_4. Each one of the 4 operating centers enters the remarks in one of these fields. On the Dashboard report, what I do is I get all these 4 fields and merge in 1 because the report is already narrow due to several other columns as well. So there is a report combining all data : =Remarks_1& " -"&Remarks_2&" - "&Remarks_3&" - "&Remarks_4 under Remarks.
The point is that the Dashboard has colorcode, Orange for Remarks_1, Red for Remarks_2, Blue for Remarks_3 and Green for Remarks_4. All these fields are memo on rich text format. On the form I have set the color of each field, however the color doesn't get set on the table as well, but only on the form fields. How can I set a defined color to each field on the table? And also when I get all data in one column, I would see all different colors.
View 1 Replies
View Related
Jul 9, 2013
I am looking to export a table to excel from access. I would like to order the transaction category column in a specific order(round trip air far, parking, lodging etc),. I have a button that runs a make query table and exports it to excel. I would like the rows to be in the order of transactions category. What code would I need in the button to make this order correct?
I have attached some code below.
Private Sub ExportDebitsButton_Click()
Dim oApp As Excel.Application
Dim oWB As Excel.Workbook
Dim i As Integer
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
[code]....
View 1 Replies
View Related
Jul 24, 2015
We need to move rich text from an Access memo field to a Word text box. So far the best Ive been able to come up with is in the code below. In this code pprs!What is a record set field of a table memo field that is bound to a text box enabled for rich text. The rich text seems to be stored as html as so I can get word to convert it by enclosing it in html tags.
Dim What As Word.Shape
Set What = doc.Shapes.AddTextbox(msoTextOrientationHorizontal , doc.PageSetup.LeftMargin, 225, 534, 0)
Dim sPath As String
sPath = "G:Temp.html"
Open sPath For Output As 1
Print #1, "<HTML>" & pprs!What & " </HTML>"
Close #1
What.TextFrame.TextRange.InsertFile (sPath)
View 2 Replies
View Related
Jan 9, 2007
Hi all
the problem i am facing is that the table exported by ACCESS to EXCEL is without any kind of formatting, bold text italics etc. , is there any way i can make access export the excel file with bold column headings and the cells having solid borders(basically any formating i wish to give).
Each time i export the table i have to open excel and format the spreadsheet giving headings highlighting stuff and all and it is very troublesome so i did make a macro in EXCEL for it but i still need to open the file in Excel and run the macro. is there some way to run that macro during the export process so that the user just gets the file in the format he/she wishes.
thanks for you help in advanc
View 1 Replies
View Related
Oct 21, 2014
I'm trying to output some logging to a form with a Rich text textbox
This is what the form is displaying:
14:16:32: check OK: 500<10000andS235='s460'>
14:16:32: check OK: 500<10000andS235='s355'>
14:16:32: check failed:too short 500<1000231231 >
14:16:32: Ready ...
There is some coloring in the text but I'm not display that here (copy/paste of the textbox)
This is the HTML behind it (? txtbox in imm.window):
14:16:32: <font color=black>check OK: 500<10000andS235='s460'</font><br />14:16:32: <font color=black>check OK: 500<10000andS235='s355'</font><br />14:16:32: <font color=red><strong>check failed:too short 500<1000231231 </strong></font><br />14:16:32: <font color=green><strong>Ready ... </strong></font><br />
The problem is in the red > that are added to each line. I have no clue where they are coming from, in fact: they are NOT in the HTML.When I display this piece of HTML in IE I don't get the red > behind each line.I have tried to use <p> of <div> instead of <br/> but that makes no difference
Code:
Forms!frm_Calculationlog.txtmsg = Forms!frm_Calculationlog.txtmsg & "<div>" & _
Format(Now(), "hh:nn:ss") & ": " & _
IIf(strColor <> "", "<font color=" & strColor & ">", "") & IIf(booBold, "<strong>", "") & strMessage & _
IIf(booBold, "</strong>", "") & IIf(strColor <> "", "</font></div>", "")
I can assure you that the > is NOT in the strMessage ... f.e. this is the ouput of strMessage on the first line: 500 <10000 and 'S235' ='s460'
strColor is a string in which I can set a color ("red", "blue")
booBold is a boolean with which I can set text to bold
View 4 Replies
View Related
Sep 13, 2005
Hello,
I have a table in Access and would like to export it using code into specific fielfs of a template in Excel.
My table has 3 fields:
SSN
FIRSTNAME
LNAME
I would like to export the recorsed to a template named MyTemplate. This template has a workbook named MyWorkbook.
The only problem is that I need to copy the active recorset (meaning the one which I will select) in a column and not into a row.
Example: I will select a record using a combo and then data will be copied from my Table into the cells B1 (ssn), B2 (FIRSTNAME), B3 (LASTNAME)
Any idea or help? Thanks
View 3 Replies
View Related
Aug 14, 2013
I'm using Access 2010. I'm passing a string into the OpenArgs of my report - works fine. In the report there are 3 rich text fields which may contain the text I passed in, and if so I want to change the color of that text to red so it stands out.
The value passed to the report changes so I'll need to use VBA in the detail's format section to check each of the 3 rich text fields.
View 5 Replies
View Related
Jul 23, 2015
I have been sending plain text emails for a while, but now I have a project where the formatting of the text needs to be specific and I need to send as rich text.
I can use the rich text from a table, excel, or word, but I am at a loss on how to get the data to Lotus Notes.
View 1 Replies
View Related
Oct 28, 2013
I have successfully put together some VBA code that will accept a user's input into a textbox on a form. A cmdFindprinter button is clicked and the query is ran. The user is asked via an inputbox for their login ID so that the query is exported to a text file on the desktop. The query then pops up in a new tab and also automatically exports the queried record to a text file on the desktop. I have upward of 30 users using this form at any given time and I need the following automated.
What I would like to do is to have the text file go into a specific format. For example:
IP address:
Serial number:
Location:
The name of one of the queries is "Xerox IP Query", the field names would be "IP Address", "SerialNumber", and "Site Name".
This is what comes up in the text file right now:
"CXF345946","157.229.243.58","123 Happy Ave"
I'd like to remove the quotes and have the info fall into place as shown in the example above.
This is the code so far:
Code:
Private Sub cmdFindprinter_Click()
On Error GoTo cmdFindprinter_Click_Err
Dim strPath As String
userNT = InputBox("Please enter your NT ID", "ServiceBase Xerox Printer Query", "Enter your NT ID")
strPath = "C:Users" & userNT & "DesktopPrinterQuery.txt"
If Heading = 0 Then Exit Sub
[code]....
View 4 Replies
View Related
Sep 10, 2013
I have a VBA code to import mail from Lotus Notes into Access. The database user is able to read his email inside Access, similar to any email program.
Unfortunately, when I use the GetItemValue (lotusscript) method to read the body of the email message, Notes will render the Rich Text information as Plain Text, and I end up with no formatting information (bold letters, underline, text color, etc.)
How to import messages from Notes to Access and keep the text formatting? I am storing the data in a Rich Text Memo field in a table. I have found code to write HTML (MIME) messages, but not to import them into Access.
View 2 Replies
View Related
Jul 24, 2014
I'm about to connect my DB to word. So I made a form where the user has to choose what entry to export. The data is inserted in a word file in different bookmarks. But there is one special task to insert the rich text so in this case the html formatted text is displayed like this:
Code:
<html><div>asdf</div></html>
My Text is inserted like this:
Code:
wdApp.ActiveDocument.Bookmarks("-Bookmarkname-").Range.Text = Lrs("-ColumnName-")
Lrs is a Recordset.
So how is it possible to display the html code right in the Word doc?
View 1 Replies
View Related
Sep 16, 2013
I have a button on a access database form that runs a query and exports the data to an excel sheet that remains open. I am ok with this. What I would like to do now is format the sheet and then save it as a file name that is the same as the query name but adding the date at the end. Here is what I have so far:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Dim stDocName As String
stDocName = "Qry_SentForProcessing"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.RunSavedImportExport "Export-Qry_SentForProcessing"
[code]....
I just want to add the code to this button. Or do I need to write a function as a module, then call the function after the export is run.
View 1 Replies
View Related
Aug 25, 2013
i want to export a table to excel , open this file and execute a macro from another file.
the code i have now is :
Code:
DoCmd.OpenTable "Overzichtaanwezigheid", acViewNormal
DoCmd.RunCommand acCmdExportExcel
DoCmd.Close acTable, "Overzichtaanwezigheid"
Dim XL As Object
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open ("C:UsersErwinDocumentsOverzichtaanwezigheid.xlsx")
XL.Visible = True
XL.Run "d: est.xlsm!Macro3"
Opening the excel file goes ok, running the macro however not.
View 1 Replies
View Related
Dec 14, 2004
The field type is "memo", the value is as following:
MELTING POINT: 166 C +/- 3 DEGREES C
MELT POINT SOFT PEARL TPU, T3080A BASE: 140 DEGREES C +/- 5
TPU-M9025 HARDNESS: 73-78 SHORE A MS5000C MELT POINT: 123 +/-5
TPU-M9025 MELTING POINT: 135 +/- 5 DEGREES C
8710 TPU T3080A MELT POINT: 144 +/- 5 DEGREES, NOT FOR BONDING
0.7MM FS-8088 MELT POINT: 138 DEGREES C +/- 5 DEGREES
After exported to Excel, some text (red font above) is missing, like below. If I copy to Excel, the same error.
MELTING POINT: 166 C +/- 3 DEGREES C
MELT POINT SOFT PEARL TPU, T3080A BASE: 140 DEGREES C +/- 5
TPU-M9025 HARDNESS: 73-78 SHORE A MS5000C MELT POINT: 123 +/-5
TPU-M9025 MELTING POINT: 135 +/- 5 DEGREES C
8710 TPU T3080A MELT POINT: 144 +/- 5 DE
How to fix this problem? Thanks!
View 3 Replies
View Related
Aug 18, 2014
I am using Access 2010 . I need to format cells inside the Excel spreadsheet
Here is my code:
Dim ApXL As Object
Dim xlWBk As Object
Dim xlWSh As Object
Dim intColumn As Long
Set ApXL = CreateObject("Excel.Application")
[Code] .....
The code "With xlWSh.Selection" returns a run-time error 438 - Object does not support this property or method
When coding, when entering a "bang" ("."), Access normally returns the next piece of code. The code above does not! How to I correct this?
I do have a reference to Microsoft Excel 14.0 Object library....
View 3 Replies
View Related
Aug 30, 2014
I'm trying to create a button that will export the filtered records on the screen to an Excel file.
I'm using strWhere as my where string and found this code in one of the posts from this forum, but unfortunately, I can't get it output only the filtered records. It outputs all records instead.
Dim db As dao.Database, qdf As QueryDef, mySQL As String
Dim strWHERE As String
Const strSQL = "SELECT * FROM [Action Register] "
[Code].....
View 11 Replies
View Related
Jun 13, 2014
So I had this code working and then I cleaned it up a little and it no longer works. It should export data from a created query using criteria selected by the user on a form and put it into an excel file that exists. I get no errors but it does not export anymore. After pouring over it for a while checking for mistakes with my form control references and variables I have yet to find anything. I did change my form name and edited the code accordingly after I already had it working, and changed a few form settings but changing them back did not fix the issue. I am not very experienced and stumped since I am not getting error messages.
Code:
'First set variables for the SQL string and CreateQueryDef command
Dim strExport As String
Dim qdf As dao.QueryDef
'Then define the SQL to be exported (Static Response Info by ItemID)
[Code] ......
View 6 Replies
View Related
Dec 11, 2013
I'm exporting a query to Excel, and I want to be able to conditionally format certain rows of the export using Access VBA. Is this possible?
View 1 Replies
View Related
Aug 18, 2014
I have a main form with two subforms. I'm trying to get my code so that it allows me to put 1 subform on one tab and the other spreadsheet on the other tab.Heres my code:
Code:
Option Compare Database
Public Function Send2Excel(frm As Form, Optional strSheetName As String)
' frm is the name of the form you want to send to Excel
' strSheetName is the name of the sheet you want to name it to
[code]...
It won't let me pass more than one subform when I call Send2Excel, so I have to list it twice, which opens two excel files.
View 14 Replies
View Related
Jan 31, 2014
I have 2 databases, mymacros.mdb and otherdb.mdb
I am writing some vba code in mymacros.mdb to try and export a table from otherdb to excel. I do this becuase there is a new copy of otherdb created on a daily basis.
I have tried using docmd.output and docmd.transferspreadsheet to achieve this but dont know how to specify that the table I am exporting is in the otherdb.mdb file.
View 5 Replies
View Related
Aug 21, 2013
Is there a command that I can use to export a spreadsheet to Excel...
I could use docmd.transferspreadsheet
however that would also mean i would need an input window where users would need to manually put in the location they wish to save to...
Instead, could i not get a "SaveAs" command window or a file browser at least for them to search that way?
Alternatively, If it was possible to use VBA to pop up the "Export - Excel Spreadsheet" window, that would be just as good.
View 2 Replies
View Related
May 15, 2014
I have a query tool that allows users to create their own custom queries. Basically, it's a form that allows the user to check boxes for the fields they want to see. The code behind it simply hides the fields in the query for which the user has not checked the box. That works very well.
My problem is I would like to have a command button that will export the query to excel. The OutputTo and TransferSpreadsheet commands will just export the whole query into excel regardless of whether or not the field is checked. I'm looking for a way to only export the columns the user has checked. Is this possible, and if not is there a workaround that would do something similar?
View 7 Replies
View Related
Feb 27, 2014
I have a database, which analyze rent contracts.
I export each rent contract to excel by the following code.
Each contract gets each spreadsheet. So right now i export all contracts.
Code:
Private Sub Befehl1_Click()
Dim xlApp As Object 'Excel.Application
Dim xlBook As Object 'Excel.Workbook
Dim xlSheet As Object 'Excel.Worksheet
Dim rstID As DAO.Recordset, tmpStr As String
Dim rstGr As DAO.Recordset, strSQL As String
[Code] .....
Is it possible that, before the exports starts that an import box shows up and the user can enter special contracts by SUWID number?
For example 5,6,7 and 10.
View 11 Replies
View Related
Jun 18, 2014
I have a Listbox named List5 and a search textbox named txtProperty and a table name sms , after i search in textbox the results in listbox . i would link to inport the results in listbox to excel but the code i have export the whole table to excel .
here is my code
''''''''*''''''''*''''''''*''''''''*''''''''*''''' '''*''''''''*''''''''*'
''''''''*''''''''*'''''''' BUTTON 3 ''''''''*''''''''*''''''''*'''''''
''' EXPORT THE LIST TO EXCEL AS List5.XLS ''''''''*''''''''*''
''''''''*''''''''*''''''''*''''''''*''''''''*''''' '''*''''''''*''''''''*'
''''''''*''''''''*''''''''*''''''''*''''''''*''''' '''*''''''''*''''''''*'
Dim outputFileName As String
Dim oXL As Object
Dim oExcel As Object
Dim sFullPath As String
Dim sPath As String
outputFileName = CurrentProject.Path & "List5.xls"
[Code] ....
View 3 Replies
View Related
Mar 19, 2014
the access database is about contracts.Each contract has an ID. So starting from ID1 to ID250. Right now i export in via VBA to excel. I have to create before in the excel the 250 tables. If the ID10 is not existing anymore i still have the table 10 left and then i have to delete this table.
Code:
Dim xlSheet As Object 'Excel.Worksheet
Dim rstID As DAO.Recordset, tmpStr As String
Dim rstGr As DAO.Recordset, strSQL As String
[code]....
View 3 Replies
View Related