VBA에서 Google 스크립트로 변경 : From VBA to Google Apps Script
2018.11.27 15:04
VBA에서 Google 스크립트로 변경 : From VBA to Google Apps Script
From VBA to Google Apps Script
Some notes on this sectionI wrote this entire section on VBA to Apps Script transition quite some time ago, and of course some things have changed since then in the fast moving world of Apps Script. My new book is all about this subject and contains brand new information, especially if you are interested in VBA to Apps Script migration. You'll also find some adapted material from the book here.
What is Google Apps ScriptVBA is to Office as Google Apps Script is to Google Apps. Those tasks to automate repetitive sequences, or extend the functionality of Office can usually be done in Google Apps Script. Not only that, but since it is really just javaScript, you could either know the basics already, or by learning it, you will be able to write regular web applications as well as to extend Google Apps. Google Apps Scripts 'live in the cloud' and form part of the tool set available to make your Google apps experience more fulfilling.
Transitioning from VBAThese following article set will take you through an accelerated program to learn javaScript and Google Apps Script with an emphasis on how to use it to do things you already know how to do in VBA, by showing you how it's done in each language.
First observation - it's painfully slow compared to the same thing in VBA, but see Optimizing access to sheet values. This a feature rich caching capability, both read and write, and applying to all range methods that have both a set... and get... version.
Many of these libraries are now part of a Google Apps Script shared library you can incorporate in your own project.
Running Apps Script from VBAThis is often a good way of migrating a step at a time. Take a look at Integrating VBA and Javascript and this blogpost to see more on this approach
AbstractionI have talked about data abstraction extensively on this site, meaning separating the physical data location from the data itself so that procedures are not aware of where the data is coming from, or even that it originated in Excel. This approach will serve us well, since it means that if we simply change the Data Manipulation Classes to understand about the Google Apps Data structures, the bulk of the logic will remain intact, even if they do have to be translated.
If a regular visitor to this site or the associated blog, you will know that many main functions are executed in one or a just a few lines of code, and generally speaking these avoid addressing specific Excel capabilities through data abstraction. Once the underlying libraries and classes are ported to Google Apps, it will be a simple job to port most of the Excel procedures on this site.
Things we need to get started
Project conversion
Power of apps scriptVBA is often not given the credit it deserves as a very well integrated and capable language, with plenty of bundled capability to reach into the object model of Office - but it's not really going anywhere. Although you can't believe everything you read, you can see where even Microsoft are going with HTML5 and javaScript versus VBA.
The Google Apps API is very powerful, and is evolving very quickly. Expect to see continued added functionality.
Some slides with a sample of VBA function translated to Google Apps Script
[출처] http://ramblings.mcpher.com/Home/excelquirks/gooscript |
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.

