Save Excel File As HTML - Keep Formatting
Dec 23, 2011How i can save my excel file as HTML but keep my formatting stay exactly the same as my excel file?
View 1 RepliesHow i can save my excel file as HTML but keep my formatting stay exactly the same as my excel file?
View 1 RepliesI have a folder containing 40 single sheet excel workbooks and I would like to automate following tasks:
- Open each excel file (need to open the file so as to update it since it gets the data from another workbook through =formulas)
- Copy paste as values
- Save this as excel html in the same folder as original excel files (keeping the original file name)
- Close (original excel file should not be changed ie formulas should remain in place, only the html file will contain values)
- Since there will always be xHtml files with same name need the macro to replace the excisting file
My abilities with excel are limited to functions, no VBA knowledge other than finding ready codes and pasting them in the module.
Since this routine is to be run almost daily the macro should run all files, instead of one by one.
I just hope that I am not asking too much for excel to handle and I hope that explanation is clear.
I'm working on creating a custom HTML report with javascript that I will be using to import in to excel to populate some graphs. Basically everything is working, except if I use javascript to show me a value.
When I use Import Data from Web via excel, everything gets imported except for the javascript part of the html doc.
An example of the html file (stripped down to nothing but 3 peices of data): [URL]
Im trying to use excel as part of an real time display system, what im looking to do is after xx time period import some data (which is fine, I have that bit sorted), then save to as html- (hopefully using excel 07 abilty to repubish data to update the same file with more info).
I have added some Javascript to the html file to auto scroll, and then will be adding a refresh script which should hopefully update the display with any new info genrated from excel...
so far I have found the following code, but could do with a hand to tie it all up!
Code:
Public Sub Watchon()
State = "Mointoring Folder..."
Timerun = Now() + TimeValue("00:10:00")
Application.OnTime Timerun, "DetectNewFiles"
Userform1.Nextupdate.Caption = ">Next Update will be @: (" & Timerun & ")"
With ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
[code]....
Then within DetectNewFiles Sub, I need to update the html data, I guess I can't reuse the above bit, as it would just overwirte the whole file (and so remove javascripts too).
Code:
Sub DetectNewFiles
'Some code to import text files to excel
With ActiveWorkbook.PublishObjects("Book1_24990")
.Publish (False)
.AutoRepublish = True
End With
Some code to reset next time update of DetectNewFiles
am using Excel 2010 and having issues trying to save a worksheet to a specified file location with the save date....
I have tried several posts form this forum and elsewhere and can't seem to get the macro to do what I want.....
I want to save a 'worksheet' from an open workbook that I use for updating information to the same file path as the workbook with the date the file saved...
What I am trying to do is that I have an excel file with macros and it is a read-only file. In order for the user to save, I want them to only be able to save as a .xlsx file as it disables all macros. If for whatever reason, the user wants to save the file as another .xlsm file, they should be allowed but before they save, a "are you sure you want to save as .xlsm?" message should pop up.
All the options in the save as box should still be available in case they want to save in that particular format. Just that the .xlsx should be the default.
VBA coding for automatically saving an excel file as another file using the current date as part of the file name together with "32ga" as a constant add-in. I also what this macro to run at a particular time of the day let say 00:20hrs. The excel file i want to save as is always open . It has data that changes every 24-hrs.
View 1 Replies View RelatedI am trying to create a macro to run from a form button, within a report, to save a file to a variable file path and name depending on the date value in cell B5.
The format of B5 looks like - 13/08/2014 16:39
The file path has folders for each year in format "yyyy" with each year having sub folders for each month in format "mm".
The file name is just the date only and is formatted "dd.mm.yy" e.g. 13.08.14
I have tried the code below in various permutations but always end up with an error - Method 'SaveAs' of object '_Workbook' failed.
[Code] ......
A co-worker of mine is exporting files from Quickpen as excel files, but every time he names the files with any Uppercase letters in the files name, they are automatically changing to all lower case. Even when he tries to rename the files, they will not stay with any uppercase letters....I have searched all over and cannot find a solution. If he sends ME the file, I can open it in excel and save it with any cases.
View 2 Replies View RelatedI have created a macro in excel 2010 which enable the file to save (extract) data into separate location and name. The vba code for macro is as follows: Question: How can I save this workbook with reference to the value containing in cell B2? (it is named temporary now - as defined in the code)
Sub aaa()
'
' aaa Macro
'
[Code].....
I have some daily text files in a folder (so about 30 of them each month), which in the end of month, I need to open them up in excel, format them so that I can use the information for my analysis.
I would like to create a macro, to quickly open them all up at once and save them each individually in .xls or .xlsm format.
I am new to VBA and after some research online, I was able to have the files open with the following code. but now I don't know how to proceed further to save them one by one with the same name but in .xls or .xlsm format.
Sub Opentxtfiles()
Dim MyFolder As String
Dim myfile As String
[Code].....
I would need to get HTML source code from any given page. I know how to open a HTML page from Excel and I can do it with VBA, but how to get for example this page's source code?
I would start with making a sub that takes a string (the address) as an input parameter and finish with saving the source code of that address as an text file like c:code.txt
So something like
Dim webaddress as string
Sub GetSourceCode(webaddress)
'then some code to save the source code
End Sub
I have modified the export a range to HTML code from Mr Walkenbachs excellent book and it all works well (still learning my trade with vba!!). The only issue I have is when the code a save as dialogue box appears. As I am looking to automate this process I was hoping to get this code to automatically save preferably to a path ("c:dailyrange.htm" for eg). I have tried various permutations but am really struggling with the concept.
I am using excel 2003.
The code
Sub ExportToHTML()
' Dim ws As Worksheet
Dim Filename As Variant
Dim TDOpenTag As String, TDCloseTag As String
Dim CellContents As String
Dim Rng As Range
Dim r As Long, c As Integer
'Create 7 htmls one for each column of the specified range
For Column = 1 To 7
Range(Cells(14, Column), Cells(40, Column)).Select
' Use the selected range of cells
Set Rng = Application.Intersect(ActiveSheet.UsedRange, Selection)
I have excel 2003 and I have a macro that sorts data and then saves it as an HMTL page. When I was upgraded to excel 2003, it started saving the sheet as 'mhtml', which is causing me other problems. using:
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
"C:Documents and Settings holg1My DocumentsQCMA events2007 est.htm" _
, "Event", saverange, xlHtmlStatic, "total_points_2007_8160", "")
.Publish (True)
.AutoRepublish = False
End With
with a defined document name (test.htm), it works (saves as html doc). using:
eventname = "jan22"
With ActiveWorkbook.PublishObjects.Add(xlSourceRange, _
eventname, "Event", _
saverange, xlHtmlStatic, "total_points_24036", "")
.Publish (True)
.AutoRepublish = False
End With
with a variable document name (jan22), it saves as mhtml. How do I make it save as an HTML doc instead of an MHTML doc?
I would like to be able to navigate to a site and save the source text of the html into a text file.
View 3 Replies View RelatedI have all my data on an Excel2000 spreadsheet and want to save it or export it out as text with just a space between each piece of data.
View 12 Replies View RelatedI am running Excel 2011 on Mac OS X. I am trying to save a file (.xls) to a server (Autumn). I have tried several configurations to try to get the file saved properly. File name is "Testfile.xls"
1. folderpath = "Autumn:Tim:TestFolder:" & filename --Activeworkbook.Saveas filename:=folderpath
2. folderpath = "Tim:TestFolder:" & filename Activeworkbook.Saveas filename:=folderpath
3 Activeworkbook.Saveas folderpath
When I try this, I get an Error 1004 indicating that it cannot find the file. Do I need to eliminate the .xls and then specify that when I do the saveas?
I've been working on this problem on and off for a number of months now and have just about got it sussed so thought I'd share it with you as it has mostly been down to postings on this board that I've got it in the end.
Thanks especially to 'biggoan' for his post: http://www.mrexcel.com/board2/viewto...136&highlight=
Anyway, this seems to avoid the need for a class module but does need you to install the Acrobat Distiller object references in Tools...References in the VBA editor.
You also need to go into the printer properties of the your Adobe PDF 'Printer' and under Printing Preferences...Adobe PDF Settings deselect the Do not send fonts to "Adobe PDF" option. Why, who knows!
Private Sub Create_PDF()
'Created by Dom Hill with considerable asistance from Biggoan and Mr Excel
Dim tempPDFFileName As String
Dim tempPSFileName As String
Dim tempPDFRawFileName As String
Dim tempLogFileName As String
Sheets("Sales Data").Activate
tempPDFRawFileName = "C:" & Range("A1").Value
'Define the postscript and .pdf file names.
tempPSFileName = tempPDFRawFileName & ".ps"
tempPDFFileName = tempPDFRawFileName & ".pdf"
tempLogFileName = tempPDFRawFileName & ".log"
' Print the Excel range to the postscript file
ActiveSheet.PrintOut Copies:=1, preview:=False, ActivePrinter:="Adobe PDF", printtofile:=True, Collate:=True, prtofilename:=tempPSFileName
'Create PDF File
Dim myPDFDist As New PdfDistiller
myPDFDist.FileToPDF tempPSFileName, tempPDFFileName, tempShowWindow
'Delete PS File
Kill tempPSFileName
Kill tempLogFileName
End Sub
Not sure why the macro creates a log file but if you know more about VBA then you probably would.
I am trrying to save an Excel 2003 file as text. This is how the cells appear in Excel.
:20:CBR:32A:040112GBP4000,00:50a:/To Be Pre-Populated:57a://SC112233:59:/93442134:70:
Each is fine except
:32A:040112GBP4000,00
which appears as
":32A:040112GBP4000,00"
These speech marks are not wanted but I can't find a save format that does not insert them.
USING EXCEL 2010
I am trying to record a macro where the last step is to SAVE AS the file. I want it to use the current date as the end of the file name.
i.e.
Daily OST -- 2012-08-10
Daily OST -- 2012-08-11
Daily OST -- 2012-08-12
etc...
This is what is currently in the macro but all it gives me is the first part "Daily OST --". How to fix?
ActiveWorkbook.SaveAs Filename:= _
"Y:ProjectsProgram ManagementPIODaily ReportsDaily OST -- " & DateString & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
I have an Excel worksheet (2007 version) which I am trying to save as a PDF file. However, the PDF option is not listed in my "Save as type" drop down window.
View 3 Replies View RelatedUsing Excel 2010, I have a workbook containing a variable number of PDF files captured as embedded OLE Objects. I wish to save each of the embedded PDF files to disk and assign the filename based on the contents of column 1 of the row containing the OLE Object.
View 1 Replies View RelatedI run excel 2010... I have xls file (see file attached) with both English and Non English characters.
When I save this file as xls or xlsx - everything is good, but when I save the file as CSV and try to open it later - I see that the English characters stays the same but the non English characters become gibberish.
How can I save a file (that include some non English characters) as CSV without loosing the non English characters? Is there a way to do that from within the excel 2010 menus? Or maybe there is an external tool?
Attached file : 913365454523.xls
[URL]
Excel takes about 10 minutes in the saving process. When I say 10 minutes, I mean, the excel screen freezes (says not responding) for about 10 minutes, then it actually saves at the very end in the normal time any other file would take as you watch the progress bar go forward.
I know many of the common answers and have tried. reducing the calculation time (which in turn reduces the saving time).
But in my circumstance, the calculation takes a very reasonable amount of time, and you see the progress % going forward.
- I would say I have about 2000 rows, and 15 columns.
- They have sumifs formulas.
- They link to a different workbook.
- The workbook I am working on saves to the network
- the source of my sumifs are also in the same folder on the network
- the recalculation takes about 10 seconds at most
- i have turned off recalculate before saving, it is all on manual calcs
- when i hit save, there are no calcs being performed
- there are no macros in the workbook
- there are only about 2 names in the name manager
- then it freezes for about 10 minutes.
- then the progress bar starts moving then it saves.
What is it doing in those 10 minutes?
1 more item to note, when I break the links to the workbook and thereby removing the sumifs formulas, its a snap.
Why does the existence of the sumifs extend saving time? I would completely understand if it elongated calculation time, but if calculation is off, then why does it even worry about it when saving?
I have workbook I would like to auto save to PDF copy file in different location every time the original file is save maybe some VBA code
View 4 Replies View RelatedI recorded a macro to save my file as PDF and assigned the macro to a button. Easy. Now I would like to change my macro to pause when the file is saving to allow the user to enter a file name. If that is not possible, I'd like to reference a cell to use as the file name. I have gone through other posts and tried changing my macro, but always get an error. I am using Excel 2010. Following is my code for saving to pdf.
Sub SavePDF()
'
' SavePDF Macro
'
[Code]....
I need to "convert" Excel table to TXT or CSV file, but delimiters have to be ";" and text must be in quotation marks "".
View 1 Replies View RelatedI just got a new computer and upgraded to Excel 2010 and Windows 7. When I try to open a workbook in Excel 2010, my saved file paths on the left side of the screen are gone. I want to put them back in there.
In Excel 2007 running Windows XP, I would just right click in the left side menu and click "add" and now that's no longer an option.
I have an excel workbook, and in that workbook, i have one worksheet with multiple tables. Any sample code wherein i can save in a seperate excel file the range that i selected?? because the tables in the worksheet are in different ranges and i would like to save just a part of that table in a separate excel file..
View 3 Replies View RelatedI have workbook I would like to auto save to PDF copy file in different location every time the original file is save maybe some VGA code is this possible ???
View 1 Replies View Related