Results 1 to 2 of 2

Thread: Save as

  1. #1
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Unanswered: Save as

    I have created a button to save my spreadsheet as a webpage here is the code when I hit the button:

    ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
    "C:\WINDOWS\Personal\Emailed Proposals\Page.htm", "FRONT", "", xlHtmlStatic, _
    "Proposal for XL_16777", "").Publish (True)
    ChDir "C:\WINDOWS\Personal\Emailed Proposals"
    Range("K1").Select

    It works great!! The only problem is it saves as the same name everytime Page.htm. In my Proposal in cell (n2) it has the Proposal number. I would like to name it using this number. Is there a way to do this?? If so, what do I need to add to my code?

    Something like "Proposal" & Cell(N2)

    Any help would be greatly appreciated!
    Michael
    Gotta to do some code

  2. #2
    Join Date
    Feb 2004
    Posts
    533
    Create a variable with your desired name and Save path use this in the PublishObjects Statement.

    Dim strPath as string
    Dim strPName as String

    ' "Proposal" & Cell(N2)
    strPath = "C:\WINDOWS\Personal\Emailed Proposals\"
    strPName = strPath & "Proposal" & ActiveSheet.Cells(2, 14)

    ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
    strPName, "FRONT", "", xlHtmlStatic, _
    "Proposal for XL_16777", "").Publish (True)
    ChDir "C:\WINDOWS\Personal\Emailed Proposals"
    Range("K1").Select
    ~

    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •