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 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 wriiten a macro in excel that pops up some photos whenever the respective cell is selected. It is working good except when I save the file in HTML format. Also what is the difference between publishing and saving html file? I am using office 2003 and microsoft web components installed.
I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .
Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?
The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).
I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.
I am doing a Regular Expression search on a string variable assigned to the HTML content of a Wikipedia search. However I am currently manually going to Wikipedia, searching for the term, saving the html page, opening the saved page with Notepad and then copying the content into a cell.
Can the above process be automated with VBA, how to assign the html content of a Wikipedia search to a string variable.
I'm trying to have a macro that opens the save as window, places the name in cell f5 and then allows you to save the workbook with cell f5 as the filename. I have managed to get the save as window to come up and the cell f5 as the name, but when I press save is doesn't. Here is what I have (also, is there a way to direct this to a specific folder).
I have a macro that copy one sheet of the Active workbook and sends it via email.
I need to add a code in this sheet so when one opens it from the email, with a command button to be able to save the file to specific, fixed folder on the local network with it’s original file name.
My spreadsheet has 32 worksheets, I've recorded a macro to do the job "save, save as with specific name", but what I want is, when save as, I wanted the file name increase in one number, and the date in a specific range "H8:J8" the date should be the next saturday.
I 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.
I found several examples on google, but unfortunatly it conflicts with another macro I use for forceing users to enable macros (hide all sheets except one if macros are disabled).
The attached file is an example contaning the save&close code and the show/hide sheets depending on macros enabled.
If the file is opened with macros disabled then only one sheet will be visible. If the file is opened with macros enabled other sheets are visible.
The problem if that this code uses a custom save, witch makes the save&close not save... (in module1 and in ThisWorkbook)
The pourpose of the save&close is to make sure some users don't forget the excel open and thus block access to it. So if a certain idele time passes excel has to save and close without any confirmation messages.
I have a macro that saves each sheet of my workbook to PDF's. I have a macro that runs prior to the save macro that filters each sheet and hides rows I do not need printed.
I simply use a formula to show a 1 in column H.
What I would like to do is sum let's say rows 5:58 and it H59 is below let's say 5 that sheet is not saved as a PDF.
I looked for awhile for a if.then macro that might solve my question, did not see anything that fit.
I want to specify a button that have the function of prompting the user to save the file as new file name. I tried to do the record macro, but I think it's not working as I wanted to. Can any expert teach me the code? As I was creating a standard form (excel file), I don't want the users to overwrite the current file name.
I work with a read-only template, and desperately need a macro that would save it as a workbook, and every worksheet of it as a separate txt file, then close the whole thing.
I will be re-using that workbook it just saved again, and I want to have the same macro there as well (that it should save my workbook as workbook and every worksheet as a separate txt file).
In My sheet I would like to check to make sure col 15 is true before going through the process of adding the contents of each row from col 6 - 10 to column 5. (Col 5 could already contain values)
This is my Private Sub Workbook_ThisWorkbook(ByVal SaveAsUI As Boolean, cancel As Boolean) BeginRow = 8 EndRow = 87 ChkCol = 15 BeginCol = 6 EndCol = 10
For RowCnt = BeginRow To EndRow If Cells(RowCnt, ChkCol).Value = True Then For RowCnt = BeginRow To EndRow Cells(RowCnt, 5).Value = Cells(RowCnt, 5).Value + Cells(RowCnt, ColCnt).Value Next ColCnt End If Next RowCnt End Sub
when I record a macro in excel and assign it to a command button, it does not save and have to keep recording it when I open up the workbook again. I notice when i close out of the script editor after saving, the debugger box does not pop up when on most occassions it does.
This does not happen all the time, just some of the time which makes absolutely no sense to me. I have double checked to make sure the module is saved under the current workbook, i have tried saving the script to my personal macro workbook (XLSTART), i have tried saving the file on a shared drive and my desktop, but nothing seems to work. The workbook is not protected and am at a complete loss.
I have a 4 sheet workbook. 3rd and 4th are hidden running formulas. These hidden sheets have macros that creates a new file from each (the macros deleted unwanted rows in the files, then save as a seperate file and format [.mht and .csv respectively]). Everything functions properly, except the problem is, I need to make sure the changes to sheet 1 are saved, but when I save the file, the changes to 3 and 4 are saved, and I lose the formulas.
I would like to run a macro AFTER the user has saved the workbook. I can only think of manipulating the before save event but dont know how to do that.
I'm trying to get a macro to run when the user presses the save button. I have the following code:
[Code] .......
This code is supposed to apply the TRIM function to every worksheet in the workbook when the user presses save, and the saves the results. I understand the Private Sub bit is the code to have the macro run during the save, but for some reason the macro itself isn't actually running. I'm not getting any error message, its just that the cells which should have the TRIM function applied to them aren't being corrected.
I have a problem in saving multiple pdfs from excel. I am posting a sheet here. First sheet has the employee details. Second sheet have the template for payslip. My aim is to save pdfs of templates of all the employee in the list using a macro.
currently i am doing it as
1. In sheet 2, I lookup each employee using the serial number of employees at the top left corner cell of the template.
2. Once the details are updated in sheet 2 i save it as pdf in my desktop.
The problem with recording macro and looping is that the pdfs are overwritting and the last pdf alone is saved. i could not find how to change the pdf name for every loop.
I need a macro that will save the range of cells with values as a pdf and saved as the sheet name. I have a macro that does a print preview function based on the cells that contain values. It works great, but instead I just need this to be saved as a pdf.
I need a before save event macro in excel that will check if sheet1 cell ref A25 = zero. If it isnt zero I want a msgbox to say "Does Not Equal Zero" to pop up, if it is zero then I do not want a msgbox displayed. In both instances I still want the file to be saved.
I would like to 'save as' my current open file with a new name equal to the value in cell A1 of the active sheet, and save it to C:Apps. I would also like to save it is a pdf with the same name and to the same location. Would that be possible in the same macro?