Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Saveas webpage (2000)

    Hi all,
    I'm trying to save a sheet within a workbook as a webpage,
    what I have now isn't working, i'm trying to pick a range from within a worksheet called Edition_Main, and it's not saving the way that I thought it would, what I get for the name fil instead of the string value of the cell.
    Thank you in Advance,
    Darryl.

    Public Sub Saxas()
    Dim fil As String
    fil = Sheets("edition_main").Range("J1").Value
    ActiveWorkbook.PublishObjects.Add(xlSourceSheet, _
    "P:PlatemakingVPC Web pagesPlateroom productionFil.htm", "Edition_Attributes", "", _
    xlHtmlStatic, "Book2_13856", "").Publish (True)

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    I'm not sure I understand your question. Do you mean that you want "fil" in "...Plateroom productionFil.htm" to be replaced by the value of the variable? If so, try
    "Plateroom production" & fil & ".htm"

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saveas webpage (2000)

    Thanks Hans,
    I tried what you said and now I it recognizes the value of the variable, but I am now getting an Application - object defined error 1004.

    So I know error, now what? what is wrong with this?

    Please don't give me the answer, just give me a hint if you would
    I want to see if I can figure it out.

    Thanks,
    Darryl.



    Public Sub Saxas()
    Dim fil As String
    fil = Sheets("edition_main").Range("J1").Value
    Application.ActiveWorkbook.PublishObjects.Add xlSourceSheet, "P:PlatemakingVPC Web pagesPlateroom production" & fil ".htm"


    End Sub

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Saveas webpage (2000)

    Whether this is the error or not; you are missing 2 characters in the Add method!
    Regards,
    Rudi

  5. #5
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saveas webpage (2000)

    Hi Rudi,
    Was it the ( ) that I was missing? I tried this and it didn't work, is my syntax wrong? Am I looking at this right? Should I be setting the object?

    Public Sub Saxas()
    Dim fil As String
    fil = Sheets("edition_main").Range("J1").Value
    ActiveWorkbook.PublishObjects.Add xlSourceSheet, _
    ("P:PlatemakingVPC Web pagesPlateroom production" & fil & ".htm")
    End Sub

    Thanks,
    Darryl

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Saveas webpage (2000)

    I see you added the extra "&" after the Fil variable. That was the one missing character. You need another "" too!

    PS: I'm just looking at syntax; I'm not sure it it will fix the Object related error!
    Regards,
    Rudi

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    It's not the brackets. You added the missing & back in.

    The problem is that you must specify the Sheet and HTMLType arguments of the Add method, and preferably the Source argument. See the online help.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    Yes, Source is a range. This is the example from the online help:

    ActiveWorkbook.PublishObjects.Add( _
    SourceType:=xlSourceRange, _
    Filename:="Server2Q1Stockreport.htm", _
    Sheet:="First Quarter", _
    Source:="D59", _
    HTMLType:=xlHTMLCalc).Publish

  9. #9
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saveas webpage (2000)

    Hans,

    Add method for the Source, do I need to specify a range If I am saving the whole sheet?

    Darryl.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    No, you are not obliged to specify a range in the Source argument, but the code is very slow if you don't, and pretty quick if you do.

  11. #11
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saveas webpage (2000)

    Hans, here is what I have, do you see anything wrong with it?
    I keep getting a list seperator, or ) error - it keeps highlighting HtmlType

    Thanks,
    Darryl.

    Dim fil As String
    fil = Sheets("edition_main").Range("J1").Value
    ActiveWorkbook.PublishObjects.Add ( _
    xlSourceSheet, _
    Filename:="P:PlatemakingVPC Web pagesPlateroom production" & fil & ".htm", _
    Sheet:="Edition_Attributes", _
    source:="A141" _
    HtmlType:= xlHTMLStatic).Publish
    End Sub

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    You forgot the comma after Source:="A141" :
    <code>
    ...
    Source:="A141", _
    ...</code>

  13. #13
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saveas webpage (2000)

    Hi Hans,
    Thanks, but I'm still getting an object defined error 1004

    Public Sub Saxas()

    Dim fil As String
    fil = Sheets("edition_main").Range("J1").Value
    ActiveWorkbook.PublishObjects.Add( _
    xlSourceSheet, _
    Filename:="P:PlatemakingVPC Web pagesPlateroom production" & fil & ".htm", _
    Sheet:="Edition_Attributes", _
    Source:="A141", _
    HtmlType:=xlHtmlStatic).Publish
    End Sub

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Saveas webpage (2000)

    If you use a drive letter, the path must begin with that letter, not with :

    Filename:="P:PlatemakingVPC Web pagesPlateroom production" & fil & ".htm", _

    If you use a UNC path, it must begin with , but not contain a drive letter and semicolon:

    Filename:="OurServerOurSharePlatemakingVPC Web pagesPlateroom production" & fil & ".htm", _

  15. #15
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Saveas webpage (2000)

    Hi,
    Is Darryl not missing an extra "" after production?
    Should it not be: Filename:="OurServerOurSharePlatemakingVPC Web pagesPlateroom production<font color=red></font color=red>" & fil & ".htm", _ seeing as the Fil variable is a file name?
    Regards,
    Rudi

Page 1 of 2 12 LastLast

Posting Permissions

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