Jump to content

Change excel cell text to Bold


CadICan

Recommended Posts

Hello,

    I'm very new to this forum. I have looked at several examples, but haven't been able to figure out how to change the text to Bold. I was able to write to the excel spreadsheet. Any help would be much appreciated. Thanks.

(VL-LOAD-COM)
(defun c:OpenExcelFile ()
(setvar "cmdecho" 0)                                                              ;turn echo off
(setvar "tilemode" 0)                                                             ;make sure in ps mode
(command "._zoom" "e" "")                                                         ;zoom extents to ensure item selected
(setq ExcelApp (vlax-get-or-create-object "Excel.Application"))
(vla-put-visible ExcelApp :vlax-true)
(vlax-put-property ExcelApp 'DisplayAlerts :vlax-true)
(setq xlbooks  (vlax-get-property Excelapp 'Workbooks))
(setq xlbook    (vlax-invoke-method xlbooks 'Add))
(setq xlsheets (vlax-get-property xlbook 'Sheets))
(setq xlsheet    (vlax-get-property xlsheets 'Item 1))
(setq xlcells    (vlax-get-property xlsheet 'Cells))
(setq fname (strcat (getvar "dwgprefix") "DwgTitleBlockInfo" ".xls"))
(vlax-invoke-method
   xlbook
   'SaveAs
   fname 
   nil
   nil
   nil
   :vlax-false
   :vlax-false
   1
   2
 )
;
(setq Cells (vlax-get-property xlsheet 'Range "A1"))

;****This is where I am having trouble setting the font BOLD
;(setq Font1 (vlax-get-property xlsheet 'Font "A1"))
;(vlax-put-property Font1 "Bold" (vlax-make-variant 1 11))



(vlax-put-property Cells 'Value2 "DRAWING No")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
(setq Cells (vlax-get-property xlsheet 'Range "B1"))
(vlax-put-property Cells 'Value2 "TITLE #1")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
(setq Cells (vlax-get-property xlsheet 'Range "C1"))
(vlax-put-property Cells 'Value2 "TITLE #2")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
(setq Cells (vlax-get-property xlsheet 'Range "D1"))
(vlax-put-property Cells 'Value2 "TITLE #3")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
;
(setq Cells (vlax-get-property xlsheet 'Range "E1"))
(vlax-put-property Cells 'Value2 "TITLE #4")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
;
(setq Cells (vlax-get-property xlsheet 'Range "F1"))
(vlax-put-property Cells 'Value2 "TITLE #5")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
;
(setq Cells (vlax-get-property xlsheet 'Range "G1"))
(vlax-put-property Cells 'Value2 "REVISION No")
(vlax-invoke-method
  (vlax-get-property xlsheet 'Columns)
  'AutoFit)
;
(princ)
)

 

Edited by CADTutor
Moved code to code block
Link to comment
Share on other sites

  • 1 month later...

It says that they have been downloaded multiple times but I can't get them to do anything when I click on them. what am I doing wrong?

Link to comment
Share on other sites

4 hours ago, BrianTFC said:

i would like to download these lisp but everytime i click on them it does nothing.

 

1 hour ago, baduke9 said:

It says that they have been downloaded multiple times but I can't get them to do anything when I click on them. what am I doing wrong?

 

I've just downloaded them without any problem - could you try again and let me know what browser/OS you are using so I can troubleshoot this?

Link to comment
Share on other sites

are you looking in right folder?

Find my downloads in Windows 10
  1. To find downloads on your PC: Select File Explorer from the taskbar, or press the Windows logo key + E. Under Quick access, select Downloads.
  2. You can also find your Downloads folder under This PC.
maybe reset your security level in your browser (I assume your login account has admin rights?)
you know the filename so use windows search...
  • Like 1
Link to comment
Share on other sites

rlx,

 

the problem is that when I click on the attachment it doesn't even give me the option to save it to a location.

Link to comment
Share on other sites

1 minute ago, BrianTFC said:

rlx,

 

the problem is that when I click on the attachment it doesn't even give me the option to save it to a location.

 

By default, your browser may just save to to the download folder, without asking you.

Link to comment
Share on other sites

right click and open in new folder? have this problem on my work too sometimes but they have a reward in the IT department for who can find the most functions to block and he or she will be the irritate king or queen of the month. Maybe try different browser. You can have the new edge browser side to side the standard internet explorer and whenever I have a site that gives me trouble I copy the link , send a picture of my mother-in-law to this site and paste the link in the new edge browser et voila...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...