Go Back   Access World Forums > Apps and Windows > Excel

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-04-2019, 05:52 AM   #1
Ashfaque
Student
 
Ashfaque's Avatar
 
Join Date: Sep 2004
Location: Nanded, India
Posts: 501
Thanks: 5
Thanked 14 Times in 14 Posts
Ashfaque is an unknown quantity at this point
Send a message via Yahoo to Ashfaque
Value generated thru code can be compared and pasted?

Hi,

I have some code behind in micro that executes an excel sheet once you start opening the excel file. Basically it reads pc address in variable GetMacAddress and displays in a msg on the screen.

Basically this is to protect my excel sheet of being used by others without my approval. Even someone takes my excel sheet and run on his pc it will bring the
pc address and it should match with pc address that I wrote somewhere on sheet. If both are matching then, the sheets calculation will run smoothly.

Till executing and bringing the pc adress in GetMacAddress value in a msgbox is ok. It is displaying fine.

Now my question is how can I paste this GetMacAddress value at the desired cell in desired sheet thru code and further it should compare with each other to run the sheet otherwize, quit excel application.

Ashfaque is offline   Reply With Quote
Old 11-04-2019, 06:38 AM   #2
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,518
Thanks: 440
Thanked 841 Times in 812 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: Value generated thru code can be compared and pasted?

You can do all that, yet cannot set a cell value?

I use
Code:
Range("A1").Value = strVariable
HTH
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 11-18-2019, 02:58 AM   #3
Ashfaque
Student
 
Ashfaque's Avatar
 
Join Date: Sep 2004
Location: Nanded, India
Posts: 501
Thanks: 5
Thanked 14 Times in 14 Posts
Ashfaque is an unknown quantity at this point
Send a message via Yahoo to Ashfaque
Re: Value generated thru code can be compared and pasted?

Thanks Gasman,

And sorry for my late reply.

What could be the code to refresh if I click a button that pasted on sheet?

Thanks again.

Ashfaque is offline   Reply With Quote
Old 11-18-2019, 03:21 AM   #4
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,518
Thanks: 440
Thanked 841 Times in 812 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: Value generated thru code can be compared and pasted?

Quote:
Originally Posted by Ashfaque View Post
Thanks Gasman,

And sorry for my late reply.

What could be the code to refresh if I click a button that pasted on sheet?

Thanks again.
Literally what I posted, except strVariable would be GetMacAddress ?

Put the code in the Wookbook_Open event and no need for a button.?

HTH
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 11-18-2019, 07:30 AM   #5
Ashfaque
Student
 
Ashfaque's Avatar
 
Join Date: Sep 2004
Location: Nanded, India
Posts: 501
Thanks: 5
Thanked 14 Times in 14 Posts
Ashfaque is an unknown quantity at this point
Send a message via Yahoo to Ashfaque
Re: Value generated thru code can be compared and pasted?

Quote:
Put the code in the Wookbook_Open event and no need for a button.?
When opens my sheet in other pc, it wont refresh thats why I thought we need to refresh the code under a button.

This button have other code lines also which are being executed smoothly.

thanks,
Ashfaque is offline   Reply With Quote
Old 11-18-2019, 08:59 AM   #6
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,518
Thanks: 440
Thanked 841 Times in 812 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: Value generated thru code can be compared and pasted?

Well put the code where you like, just assign the cell value to the result of the function as shown previously.

__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Access generated SQL code sts023 Queries 4 04-28-2011 04:02 AM
Code errors on converting 97 to 2003 see pasted code Scolds Modules & VBA 2 12-09-2005 03:34 AM
Generated Code From CMD Wizard dynamix Modules & VBA 4 04-13-2005 08:16 AM
Troubleshoot Code-generated Queries mresann Queries 3 01-28-2005 08:57 PM
Buttons Cut & Pasted, loses code?? DavidWRouse General 8 11-07-2003 01:46 PM




All times are GMT -8. The time now is 01:58 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World