Hyperlinks

jompy

Board Regular
Joined
Mar 2, 2009
Messages
189
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
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Worked out how to do hyperlink, just need a little help on storing the file name usin variables.

Many thanks
 
Upvote 0

Forum statistics

Threads
1,214,814
Messages
6,121,711
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top