Copying worksheet programmatically causes run-time error 1004 in Excel
當在一個workbook中不斷複製粘貼裏面的worksheet, 會出現 run-time error的問題. (MS Support).
解决方法: 無.
MS 推薦大家關閉workbook,然後重新打開, 或者更改template.
當在一個workbook中不斷複製粘貼裏面的worksheet, 會出現 run-time error的問題. (MS Support).
解决方法: 無.
MS 推薦大家關閉workbook,然後重新打開, 或者更改template.
Const MYCONSTANT = 100
很多時候,不同project都會大抵需要類似的文件, 例如創建一個website,基本上都要寫js, css等文件. 自己通常喜歡使用下圖所述的組織架構, 把*.js文件都放到js文件夾中, *.css文件都放到css文件夾中.
.
├── css
│ └── style.css
├── index.html
└── js
└── script.js
然而,每次都這麽做的話, 其實是挺浪費時間的. 於是, 可以先把將固定結構的文件夾保存起來, 每次創建新project的時候就直接按此創建一個副本, 再開始Project的工作.
以index.html爲例, 每個milestone就保存一個副本, 如:
然後再把這些舊的版本文件拖放到Archive文件夾中, 妥善保管. 在交貨階段, 只需要相應的文件拿出來發給客户. 詳細介紹, 可以參與該網志.



上圖中狗仔像給禁錮在一個box之中, stickout就是將box壓扁,令到狗仔部份外漏出box之外, 狗仔頓時就躍于紙面. 下面接收如何通過PPT製作類似效果
PPT 2010:
1. 點擊圖片, 格式 – 刪除背景
2. 軟件會自動識別出背景, 假如背景是純色, 軟件會好好地識別出來, 該例中軟件都基本上識別出狗仔, 通過拖拽方框, 狗仔大抵就出來了, 如果要更完美可以通過Ribbon中的兩個按鈕,添加刪除標記的區域.
3. 將原圖crop去一半, 再疊加上去,就可以出現stickout的效果
* 更簡單的做法是,不對全圖做去背景的操作,而是將圖片分為上下兩部份,分為兩圖. 只對上面的圖片做去背景.
PPT – 2003
1. 用圖示工具繪製一個任意多邊形
2. 填充繪製的多邊形
3. 將多邊形同圖片Group在一起, 剪切 – 選擇性粘貼 – 粘貼為圖片
4. 去背景
從worksheet中cell取數,常見辦法如
with sheet1 name = .cells(i,1) company = .cells(i,2) end with
此方法直接,但是欠缺機動性,假如日後worksheet有任何改動,令到name不是出現在col 1,全部代碼都需要改.
將各col在代碼頂部定義為常數, 日後需要修改就在頂部定義中修改.修改地方集中到一處,但是還是麻煩
const nameCol = 1 , companyCol = 2 with sheet1 name = .cells(i,nameCol) company = .cells(i,companyCol) end with
Private Enum AllCols nameCol = 1 companyCol End Enum with sheet1 name = .cells(i,AllCols.nameCol) company = .cells(i,AllCols.companyCol) end with
充分利用Table (Excel 2007 or higher).
先在worksheet中定義Table,再在VBA中通過ListObjects訪問
Const nameCol = "name", companyCOl = "company" set tbl = Sheet1.ListObjects("tableName") with sheet1 For each row in tbl.ListRows name = row.range(, col(nameCol)) company = row.range(, col(companyCol)) 'do something next row end with
利用ADO, 對於Excel2003, 連本workbook的時候慎防內存洩露
本文受該文啓發, 特此鳴謝
Javascript中,定義正則表達式的方法有兩個:
/* /pattern/flags; */ var re = /mac/i;
/* new RegExp("pattern","flags"); */ var re = new RegExp(window.prompt("Please input a regex.","yes|yeah"),"g");
g The global search flag makes the RegExp search for a pattern throughout the string, creating an array of all occurrences it can find matching the given pattern.
i The ignore case flag makes a regular expression case insensitive. For international coders, note that this might not work on extended characters such as ?, ü, ?, ?.
m This flag makes the beginning of input (^) and end of input ($) codes also catch beginning and end of line respectively.
參閱此處
Applies the RegExp to the given string, and returns the match information.
var match = /s(amp)le/i.exec("Sample text") //match then contains ["Sample","amp"]
Tests if the given string matches the Regexp, and returns true if matching, false if not.
var match = /sample/.test("Sample text") //match then contains false
Matches given string with the RegExp. With g flag returns an array containing the matches, without g flag returns just the first match or if no match is found returns null.
var str = "Watch out for the rock!".match(/r?or?/g) //str then contains ["o","or","ro"]
Matches RegExp with string and returns the index of the beginning of the match if found, -1 if not.
var ndx = "Watch out for the rock!".search(/for/) //ndx then contains 10
Replaces matches with the given string, and returns the edited string.
var str = "Liorean said: My name is Liorean!".replace(/Liorean/g,'Big Fat Dork') //str then contains "Big Fat Dork said: My name is Big Fat Dork!"
Cuts a string into an array, making cuts at matches.
var str = "I am confused".split(/\s/g) //str then contains ["I","am","confused"]
Example:
var s='<div style="text-align:center;width:inherit;text-color:blue;">SOME TEXT</div>' var rx=new RegExp("<div .*?>(.*?)</div>","i"); s=s.replace(rx,"$1"); // s="SOME TEXT" // http://www.tek-tips.com/viewthread.cfm?qid=1231301
SharePoint中Team Site的主頁, 默認會給創建為按7:3的比例左右分割. 這是一個煩人的問題, 因為很多時候我們並不想以這個比例劃分左右Column.
解決方法:
Tip: You can just as easily insert new rows and columns and then add new web part zones from the Insert, SharePoint Controls menu
<script> //http://techtrainingnotes.blogspot.com/2008/11/sharepoint-how-to-hide-right-web-part.html function HideWebPartZone() { var x = document.getElementsByTagName("TD") var i=0; for (i=0;i<x.length;i++) { if (x[i].width=="70%") { // left column x[i].style.width="100%"; // center (otherwise empty) column if (document.all) // is IE var x2=x[i].nextSibling; else var x2=x[i].nextSibling.nextSibling; x2.style.width="0"; x2.style.display="none"; x2.innerHTML=""; // right column if (document.all) // is IE x2=x[i].nextSibling.nextSibling; else x2=x[i].nextSibling.nextSibling.nextSibling.nextSibling; x2.style.width="0"; x2.style.display="none"; x2.innerHTML=""; // right margin column if (document.all) // is IE x2=x[i].nextSibling.nextSibling.nextSibling; else x2=x[i].nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling; x2.style.width="0"; x2.style.display="none"; x2.innerHTML=""; //all done return; } } } _spBodyOnLoadFunctionNames.push("HideWebPartZone") </script>
此方法,在IE7中流暢度欠佳.
用設置Div box的width似乎更理想
當創建web part page 之後,需要更改page 的layout (如三欄變為兩欄),可以用同名創建欲改變的layout的web part page 以覆蓋之!
註意:覆蓋會令導致原來頁面中所有內容丟失,請先做好備份! 同時該方法不適用於home page, 因為homepage 異於普通web part page,詳情參見此處
Sharepoint在某些時候,部份的元素實屬多餘,例如Quick Launch Bar等. 要將其去除,最好當然是通過SharePoint Designer. 然而很多時候, 無法通過底層修改SharePoint的模板. 於是,只能求助于CSS.
下面是Hide Quick Launch Bar代碼
<style> .ms-navframe { display: none } </style>