Results 1 to 3 of 3

Thread: Excel save & formatting questions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184

    Excel save & formatting questions

    A few questions but as its Christmas perhaps someone will help me :-)

    I'm doing some exporting from .NET into an Excel Object and I need to create a Worksheet header so the user knows what Worksheet has been Printed.

    This does not seem to work can anyone advise?
    [code]

    oSheet.Name = "UKPX Prices"
    oSheet.PageSetup.CenterHeader.Insert(0, "UKPX Prices")
    oSheet.PageSetup.RightHeader.Insert(0, "Printed: " & CStr(Format(Date.Now, "dd/mm/yyyy")))

    /[code]

    Second, I use the following to close my excel Object, but this prompts the user for a save location and defaults to the standard Workbook Name of BookX.xls. I need to provide a name such as MyBook_ddmmyyyy.xls.

    [code]

    oSheet = Nothing
    oBook = Nothing
    appExcel.DisplayAlerts = True
    appExcel.Quit()
    appExcel = Nothing

    \[code]

    I suppose I should use

    [code]
    Dim db As SaveFileDialog
    db.Filter = "MyBook_" & CStr(Format(Date.Now, "ddmmyyyy"))

    \[code]

    but I don't know how this works - how should this gthen save & get rid of the Excel Objects? Do need a Path somewhere? How does this then Save?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    I've got the Save bit sorted, but still cannot get a Header (or Footer for that matter).

    Still need your help people

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    All resolved now, but a new question for you.

    Why does the Excel Object persist for a time even after calling obj.Quit() ?

Posting Permissions

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



Click Here to Expand Forum to Full Width