ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error on Macro code line change (https://www.excelbanter.com/excel-programming/423325-error-macro-code-line-change.html)

K[_2_]

Error on Macro code line change
 
Hi all, I have code line (see below) in my macro

Const AN As String = "C:\My Documents\Pic\AN.jpg"

I want to change this above line into the code line (see below) but I
get error message with the below code line. Please can any friend can
tell that what I am doing wrong.

Const AN As String = Thisworkbook.path & "\AN.jpg"

Bob Phillips[_3_]

Error on Macro code line change
 
Just declare it as variable

Dim AN As String

An = Thisworkbook.path & "\AN.jpg"

--
__________________________________
HTH

Bob

"K" wrote in message
...
Hi all, I have code line (see below) in my macro

Const AN As String = "C:\My Documents\Pic\AN.jpg"

I want to change this above line into the code line (see below) but I
get error message with the below code line. Please can any friend can
tell that what I am doing wrong.

Const AN As String = Thisworkbook.path & "\AN.jpg"





All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com