Hi Guys
Really need your expertise on this one. Although I have done this before my code seems to be lost forever. I am looking to click a button on a worksheet lets call it "NOR". The name is generated as the sheet is generated, so I don't know until it is generated what the name would be. I then want to click a command button on this sheet and save some details in the same workbook to a sheet named orders. Basically it is for producing order forms.
After the details from the form have been extracted that are put in the last row down on the "Orders" sheet. This I can do no problem. However what I want to do, is be able to is save the document after clicking the command button as an HTML file. I want to name the file the same as the order number, which is the number in "J13" cell. I have also used a variable to catch the sheet name and this is saved as a variable entitled "Nam" This is my code[CODE
fil = Range("j13").Value
Range("A1:K55").Select
With ActiveWorkbook.PublishObjects(Nam)
.HtmlType = xlHtmlStatic
.Filename = "C:\Phils Folder\fil.mht"
.Publish (False)
.AutoRepublish = False
End With
ChDir "C:\Phils Folder"][/CODE]
So for example is the sheet is called "NOR" and the order number in "J13" is 000001 for example. I want to be able to save the contents of the sheet "NOR" in a file in "Phils" folder as a file called "000001.mht"
My code doesn't seem to work though. What would also be really cool is for the order number in column A which stores the order number be made as a hyperlink so that when you click on it, it opens up the html file. The hyperlink would in this instance be "000001"
I know it's a big ask, but any help in this direction would be greatly appreciated. I know it can be done as I have done it before....Help
Many thanks
Really need your expertise on this one. Although I have done this before my code seems to be lost forever. I am looking to click a button on a worksheet lets call it "NOR". The name is generated as the sheet is generated, so I don't know until it is generated what the name would be. I then want to click a command button on this sheet and save some details in the same workbook to a sheet named orders. Basically it is for producing order forms.
After the details from the form have been extracted that are put in the last row down on the "Orders" sheet. This I can do no problem. However what I want to do, is be able to is save the document after clicking the command button as an HTML file. I want to name the file the same as the order number, which is the number in "J13" cell. I have also used a variable to catch the sheet name and this is saved as a variable entitled "Nam" This is my code[CODE
fil = Range("j13").Value
Range("A1:K55").Select
With ActiveWorkbook.PublishObjects(Nam)
.HtmlType = xlHtmlStatic
.Filename = "C:\Phils Folder\fil.mht"
.Publish (False)
.AutoRepublish = False
End With
ChDir "C:\Phils Folder"][/CODE]
So for example is the sheet is called "NOR" and the order number in "J13" is 000001 for example. I want to be able to save the contents of the sheet "NOR" in a file in "Phils" folder as a file called "000001.mht"
My code doesn't seem to work though. What would also be really cool is for the order number in column A which stores the order number be made as a hyperlink so that when you click on it, it opens up the html file. The hyperlink would in this instance be "000001"
I know it's a big ask, but any help in this direction would be greatly appreciated. I know it can be done as I have done it before....Help
Many thanks