+ Reply to Thread
Results 1 to 2 of 2

Unable to format font after creating sheet

  1. #1
    Geoff
    Guest

    Unable to format font after creating sheet

    I have built that creates a worksheet and everything works perfect except
    when I try to select the cells and change the font to Microsoft San Serif-8.
    I get the error message "The Remote Server Machine does not exist or is
    unavailable" My code is as follows:
    xlSheet.Range("A1").Select
    xlSheet.Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    With Selection.Font
    .NAME = "Microsoft Sans Serif"
    .Size = 8
    End With
    xlApp.Application.Visible = True

    Any suggestions are greatly appreciated!



  2. #2
    K Dales
    Guest

    RE: Unable to format font after creating sheet

    xlSheet is, I assume, a sheet that is in your automated Excel session xlApp.
    But when you use 'Selection' without specifying anything different, as you do
    in the code, you are referring to the Selection property of the Excel session
    that is running the code, not the session being automated, and I suspect this
    is not what you intend and is what is causing the problem. To fix, use
    xlApp.Selection wherever you have selection.

    HTH!

    "Geoff" wrote:

    > I have built that creates a worksheet and everything works perfect except
    > when I try to select the cells and change the font to Microsoft San Serif-8.
    > I get the error message "The Remote Server Machine does not exist or is
    > unavailable" My code is as follows:
    > xlSheet.Range("A1").Select
    > xlSheet.Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    > With Selection.Font
    > .NAME = "Microsoft Sans Serif"
    > .Size = 8
    > End With
    > xlApp.Application.Visible = True
    >
    > Any suggestions are greatly appreciated!
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1